Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
joram
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
joram
joram
Commits
bc617eab
Commit
bc617eab
authored
Jan 15, 2021
by
Andre Freyssinet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a constructor with ConnectionFactory as parameter.
parent
eaf58e42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
9 deletions
+44
-9
joram/joram/tools/jmscheck/src/main/java/org/ow2/joram/tools/jmscheck/JMSConnectorCheck.java
.../java/org/ow2/joram/tools/jmscheck/JMSConnectorCheck.java
+44
-9
No files found.
joram/joram/tools/jmscheck/src/main/java/org/ow2/joram/tools/jmscheck/JMSConnectorCheck.java
View file @
bc617eab
...
...
@@ -198,16 +198,51 @@ public final class JMSConnectorCheck {
String
user
,
String
pass
,
String
qname
,
int
timeOut
)
{
if
(
cfname
==
null
)
throw
new
IllegalArgumentException
(
"Shall define ConnectionFactory name"
);
this
.
cfname
=
cfname
;
if
(
ictx
==
null
)
throw
new
IllegalArgumentException
(
"Shall define JNDI initial context"
);
this
.
ictx
=
ictx
;
this
.
user
=
user
;
this
.
pass
=
pass
;
if
(
qname
==
null
)
throw
new
IllegalArgumentException
(
"Shall define Queue name"
);
this
.
qname
=
qname
;
this
.
timeout
=
timeOut
;
}
/**
* Creates a new component allowing to check a JMS connector.
*
* @param cf ConnectionFactory to use.
* @param user User name for authentication, if no defined uses the ConnectionFactory default.
* @param pass Password for authentication, if no defined uses the ConnectionFactory default.
* @param qname Internal name of JMS destination.
* @param timeout Maximum amount of time to wait connecting and receiving messages, by default 10s.
*/
public
JMSConnectorCheck
(
ConnectionFactory
cf
,
String
user
,
String
pass
,
String
qname
,
int
timeOut
)
{
if
(
cf
==
null
)
throw
new
IllegalArgumentException
(
"Shall define ConnectionFactory"
);
this
.
cf
=
cf
;
this
.
user
=
user
;
this
.
pass
=
pass
;
if
(
qname
==
null
)
throw
new
IllegalArgumentException
(
"Shall define Queue name"
);
this
.
timeout
=
timeOut
;
}
private
void
getConnectionFactory
()
throws
NamingException
{
if
(
cf
!=
null
)
return
;
...
...
@@ -239,7 +274,7 @@ public final class JMSConnectorCheck {
*/
public
boolean
check
()
{
if
(
logger
.
isLoggable
(
BasicLevel
.
DEBUG
))
logger
.
log
(
BasicLevel
.
DEBUG
,
"JMSConnectorStatus("
+
cfname
+
").check"
);
logger
.
log
(
BasicLevel
.
DEBUG
,
"JMSConnectorStatus("
+
((
cfname
==
null
)?
""
:
cfname
)
+
").check"
);
nbtry
+=
1
;
try
{
...
...
@@ -251,9 +286,9 @@ public final class JMSConnectorCheck {
setLatencyPubSub
(-
1L
);
errorMsg
=
"Cannot get ConnectionFactory"
;
if
(
logger
.
isLoggable
(
BasicLevel
.
DEBUG
))
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
cfname
+
")<: Cannot get ConnectionFactory."
,
exc
);
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
((
cfname
==
null
)?
""
:
cfname
)
+
")<: Cannot get ConnectionFactory."
,
exc
);
else
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
cfname
+
"): Cannot get ConnectionFactory."
);
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
((
cfname
==
null
)?
""
:
cfname
)
+
"): Cannot get ConnectionFactory."
);
return
false
;
}
...
...
@@ -274,9 +309,9 @@ public final class JMSConnectorCheck {
setLatencyPubSub
(-
1L
);
errorMsg
=
"Cannot connect"
;
if
(
logger
.
isLoggable
(
BasicLevel
.
DEBUG
))
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
cfname
+
"): Cannot connect."
,
exc
);
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
((
cfname
==
null
)?
""
:
cfname
)
+
"): Cannot connect."
,
exc
);
else
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
cfname
+
"): Cannot connect."
);
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
((
cfname
==
null
)?
""
:
cfname
)
+
"): Cannot connect."
);
return
false
;
}
...
...
@@ -312,18 +347,18 @@ public final class JMSConnectorCheck {
setLatencyPubSub
(-
1L
);
errorMsg
=
"Error during message send/receive."
;
if
(
logger
.
isLoggable
(
BasicLevel
.
DEBUG
))
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
cfname
+
"): Error during message send/receive."
,
exc
);
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
((
cfname
==
null
)?
""
:
cfname
)
+
"): Error during message send/receive."
,
exc
);
else
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
cfname
+
"): Error during message send/receive."
);
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
((
cfname
==
null
)?
""
:
cfname
)
+
"): Error during message send/receive."
);
return
false
;
}
finally
{
try
{
cnx
.
close
();
}
catch
(
JMSException
exc
)
{
if
(
logger
.
isLoggable
(
BasicLevel
.
DEBUG
))
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
cfname
+
"): Error closing connection."
,
exc
);
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
((
cfname
==
null
)?
""
:
cfname
)
+
"): Error closing connection."
,
exc
);
else
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
cfname
+
"): Error closing connection."
);
logger
.
log
(
BasicLevel
.
WARN
,
"JMSConnectorStatus.check("
+
((
cfname
==
null
)?
""
:
cfname
)
+
"): Error closing connection."
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment