[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting ...
Ovidiu Feodorov
ovidiu.feodorov at jboss.com
Mon Jan 29 02:10:00 EST 2007
User: ovidiu
Date: 07/01/29 02:10:00
Modified: src/main/org/jboss/remoting Tag: remoting_2_x
ConnectionValidator.java
MicroRemoteClientInvoker.java
Log:
minor refactoring and logging improvments while trying to fix http://jira.jboss.org/jira/browse/JBREM-691
Revision Changes Path
No revision
No revision
1.13.2.10 +6 -17 JBossRemoting/src/main/org/jboss/remoting/ConnectionValidator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConnectionValidator.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/ConnectionValidator.java,v
retrieving revision 1.13.2.9
retrieving revision 1.13.2.10
diff -u -b -r1.13.2.9 -r1.13.2.10
--- ConnectionValidator.java 23 Jan 2007 09:39:02 -0000 1.13.2.9
+++ ConnectionValidator.java 29 Jan 2007 07:10:00 -0000 1.13.2.10
@@ -113,14 +113,6 @@
{
boolean pingWorked = false;
- if (trace)
- {
- log.trace("ConnectionValidator pinging " +
- clientInvoker.getLocator().getProtocol() + "://" +
- clientInvoker.getLocator().getHost() + ":" +
- clientInvoker.getLocator().getPort());
- }
-
try
{
// Sending null client id as don't want to trigger lease on server side. This also means
@@ -129,18 +121,17 @@
InvocationRequest ir =
new InvocationRequest(null, Subsystem.SELF, "$PING$", null, null, null);
+ if (trace) { log.trace("pinging, sending " + ir + " over " + clientInvoker); }
+
clientInvoker.invoke(ir);
- if (trace) { log.trace("ConnectionValidator got successful ping");}
+ if (trace) { log.trace("ConnectionValidator got successful ping using " + clientInvoker);}
pingWorked = true;
}
- catch (Throwable throwable)
+ catch (Throwable t)
{
- log.debug("ConnectionValidator failed to ping server " +
- clientInvoker.getLocator().getProtocol() + "://" +
- clientInvoker.getLocator().getHost() + ":" +
- clientInvoker.getLocator().getPort(), throwable);
+ log.debug("ConnectionValidator failed to ping via " + clientInvoker, t);
}
return pingWorked;
@@ -270,9 +261,7 @@
public String toString()
{
- InvokerLocator locator = client.getInvoker().getLocator();
- return "ConnectionValidator[" + locator.getProtocol() + "://" + locator.getHost() + ":" +
- locator.getPort() + ", pingPeriod=" + pingPeriod + " ms]";
+ return "ConnectionValidator[" + clientInvoker + ", pingPeriod=" + pingPeriod + " ms]";
}
// Package protected ----------------------------------------------------------------------------
1.7.2.11 +20 -39 JBossRemoting/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MicroRemoteClientInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java,v
retrieving revision 1.7.2.10
retrieving revision 1.7.2.11
diff -u -b -r1.7.2.10 -r1.7.2.11
--- MicroRemoteClientInvoker.java 29 Jan 2007 05:09:48 -0000 1.7.2.10
+++ MicroRemoteClientInvoker.java 29 Jan 2007 07:10:00 -0000 1.7.2.11
@@ -27,7 +27,7 @@
*
* @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
* @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
- * @version $Revision: 1.7.2.10 $
+ * @version $Revision: 1.7.2.11 $
*/
public abstract class MicroRemoteClientInvoker extends AbstractInvoker implements ClientInvoker
{
@@ -40,7 +40,7 @@
private String dataType;
private final Object clientLeaseLock = new Object();
private LeasePinger leasePinger = null;
- private String invokerSessionId = new GUID().toString();
+ private String invokerSessionID = new GUID().toString();
public MicroRemoteClientInvoker(InvokerLocator locator)
{
@@ -76,7 +76,8 @@
if (marshaller == null)
{
// went as far as possible to find a marshaller, will have to give up
- throw new InvalidMarshallingResource("Can not find a valid marshaller for data type: " + getDataType());
+ throw new InvalidMarshallingResource(
+ "Can not find a valid marshaller for data type: " + getDataType());
}
setMarshaller(marshaller);
}
@@ -98,7 +99,8 @@
if (unmarshaller == null)
{
// went as far as possible to find a unmarshaller, will have to give up
- throw new InvalidMarshallingResource("Can not find a valid unmarshaller for data type: " + getDataType());
+ throw new InvalidMarshallingResource(
+ "Can not find a valid unmarshaller for data type: " + getDataType());
}
setUnMarshaller(unmarshaller);
}
@@ -211,24 +213,15 @@
}
- /**
- * @param sessionId
- * @param invocation
- * @param marshaller
- * @return
- * @throws java.io.IOException
- * @throws ConnectionFailedException
- *
- */
protected abstract Object transport(String sessionId, Object invocation, Map metadata,
Marshaller marshaller, UnMarshaller unmarshaller)
throws IOException, ConnectionFailedException, ClassNotFoundException;
/**
- * subclasses must provide this method to return true if their remote connection is connected and
- * false if disconnected. in some transports, such as SOAP, this method may always return true, since the
- * remote connectivity is done on demand and not kept persistent like other transports (such as socket-based
- * transport).
+ * Subclasses must provide this method to return true if their remote connection is connected and
+ * false if disconnected. in some transports, such as SOAP, this method may always return true,
+ * since the remote connectivity is done on demand and not kept persistent like other transports
+ * (such as socket-based transport).
*
* @return boolean true if connected, false if not
*/
@@ -237,15 +230,10 @@
return connected;
}
-
/**
- * connect to the remote invoker
- *
- * @throws ConnectionFailedException
- *
+ * Connect to the remote invoker.
*/
- public synchronized void connect()
- throws ConnectionFailedException
+ public synchronized void connect() throws ConnectionFailedException
{
if (!connected)
{
@@ -350,7 +338,7 @@
}
}
- public void establishLease(String sessionId, Map configuration, long leasePeriod)
+ public void establishLease(String clientSessionID, Map configuration, long leasePeriod)
throws Throwable
{
synchronized (clientLeaseLock)
@@ -359,23 +347,20 @@
// lease and just need to update the lease pinger
if (leasePinger != null)
{
- leasePinger.addClient(sessionId, configuration, leasePeriod);
+ leasePinger.addClient(clientSessionID, configuration, leasePeriod);
+ log.debug(this + " added client with session ID " + clientSessionID + " to the lease pinger");
return;
}
try
{
- if(trace)
- {
- log.trace("Sending initial lease ping to server for client invoker (session id " +
- invokerSessionId + ") to determine if server has leasing enabled.");
- }
+ if(trace) { log.trace(this + " sending initial lease ping to server to determine if server has leasing enabled."); }
// configuration should NOT be passed as want ping to be specific to client invoker
// and NOT to the client.
InvocationRequest ir =
- new InvocationRequest(invokerSessionId, null, "$PING$", null, new HashMap(), null);
+ new InvocationRequest(invokerSessionID, null, "$PING$", null, new HashMap(), null);
Object ret = invoke(ir);
@@ -399,14 +384,10 @@
}
}
- if(trace)
- {
- log.trace("Server does have leasing enabled (with default lease period of " +
- defaultLeasePeriod + ") and will start a new lease pinger.");
- }
+ if(trace) { log.trace("server does have leasing enabled (with default lease period of " + defaultLeasePeriod + ") and will start a new lease pinger."); }
- leasePinger = new LeasePinger(this, invokerSessionId, defaultLeasePeriod);
- leasePinger.addClient(sessionId, configuration, leasePeriod);
+ leasePinger = new LeasePinger(this, invokerSessionID, defaultLeasePeriod);
+ leasePinger.addClient(clientSessionID, configuration, leasePeriod);
leasePinger.startPing();
}
}
More information about the jboss-cvs-commits
mailing list