[jboss-svn-commits] JBL Code SVN: r16048 - labs/jbossesb/workspace/bramley/product/rosetta/src/org/jboss/soa/esb/addressing/eprs.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Oct 24 09:00:24 EDT 2007
Author: mark.little at jboss.com
Date: 2007-10-24 09:00:24 -0400 (Wed, 24 Oct 2007)
New Revision: 16048
Modified:
labs/jbossesb/workspace/bramley/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/InVMEpr.java
Log:
removed check on instance variables for get (breaks when copying).
Modified: labs/jbossesb/workspace/bramley/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/InVMEpr.java
===================================================================
--- labs/jbossesb/workspace/bramley/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/InVMEpr.java 2007-10-24 11:17:15 UTC (rev 16047)
+++ labs/jbossesb/workspace/bramley/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/InVMEpr.java 2007-10-24 13:00:24 UTC (rev 16048)
@@ -21,7 +21,6 @@
* @author mark.little at jboss.com
*/
-
/**
* This class represents the endpoint reference for services.
*/
@@ -39,44 +38,49 @@
*
* EPR: invm://servicename[?lockstep[#waittime]]
*
- * where lockstep can be either true or false and waittime is the
- * lockstep wait time in milliseconds. If lockstep is false then any
- * value specified for waittime will be ignored.
+ * where lockstep can be either true or false and waittime is the lockstep wait
+ * time in milliseconds. If lockstep is false then any value specified for
+ * waittime will be ignored.
*
* e.g.,
*
- * invm://myservice?true#20000
- * invm://myservice
- * invm://myservice?false (same as invm://myservice)
+ * invm://myservice?true#20000 invm://myservice invm://myservice?false (same as
+ * invm://myservice)
*
- * You can have a lockstep service, where the sender thread is tied to
- * the one that does the execution (equivalent to the sender thread doing
- * the work within the receiver), or non-lockstep, whereby the sender thread
- * is decoupled from the receiver and works as fast as it needs to in order
- * to deliver messages. This is roughly equivalent to CORBA POA threading
- * policies. (Maybe we'll implement it that way at some point in the future?)
+ * You can have a lockstep service, where the sender thread is tied to the one
+ * that does the execution (equivalent to the sender thread doing the work
+ * within the receiver), or non-lockstep, whereby the sender thread is decoupled
+ * from the receiver and works as fast as it needs to in order to deliver
+ * messages. This is roughly equivalent to CORBA POA threading policies. (Maybe
+ * we'll implement it that way at some point in the future?)
*
* @author marklittle
- *
+ *
*/
public class InVMEpr extends EPR
{
- public static final long DEFAULT_LOCKSTEP_WAIT_TIME = 10000; // in millis, 10 seconds
-
+ public static final long DEFAULT_LOCKSTEP_WAIT_TIME = 10000; // in
+
+ // millis,
+ // 10
+ // seconds
+
public static final String INVM_PROTOCOL = "invm";
+
public static final String LOCKSTEP_ENDPOINT_TAG = "lockstep";
+
public static final String LOCKSTEP_WAIT_TIME_TAG = "lockstepWait";
-
- public InVMEpr (EPR epr)
+
+ public InVMEpr(EPR epr)
{
copy(epr);
}
-
- public InVMEpr (EPR epr, Element header)
+
+ public InVMEpr(EPR epr, Element header)
{
copy(epr);
-
+
NodeList nl = header.getChildNodes();
for (int i = 0; i < nl.getLength(); i++)
@@ -85,19 +89,22 @@
{
String prefix = nl.item(i).getPrefix();
String tag = nl.item(i).getLocalName();
-
- if ((prefix != null) && (prefix.equals(XMLUtil.JBOSSESB_PREFIX)))
+
+ if ((prefix != null)
+ && (prefix.equals(XMLUtil.JBOSSESB_PREFIX)))
{
if (tag != null)
{
if (tag.equals(LOCKSTEP_ENDPOINT_TAG))
{
- getAddr().addExtension(LOCKSTEP_ENDPOINT_TAG, nl.item(i).getTextContent());
+ getAddr().addExtension(LOCKSTEP_ENDPOINT_TAG,
+ nl.item(i).getTextContent());
_lockstep = true;
}
if (tag.equals(LOCKSTEP_WAIT_TIME_TAG))
{
- getAddr().addExtension(LOCKSTEP_WAIT_TIME_TAG, nl.item(i).getTextContent());
+ getAddr().addExtension(LOCKSTEP_WAIT_TIME_TAG,
+ nl.item(i).getTextContent());
_lockstepTime = true;
}
}
@@ -110,21 +117,22 @@
}
}
- public InVMEpr (URI uri) throws URISyntaxException
+ public InVMEpr(URI uri) throws URISyntaxException
{
super(uri);
String serviceId = uri.getHost();
String lockstep = uri.getQuery();
String lockstepTime = uri.getFragment();
-
+
if (serviceId == null)
- throw new URISyntaxException(uri.toString(), "No serviceId specified!");
-
+ throw new URISyntaxException(uri.toString(),
+ "No serviceId specified!");
+
if ("true".equalsIgnoreCase(lockstep))
{
setLockstep(true);
-
+
if (lockstepTime != null)
{
try
@@ -138,8 +146,8 @@
}
}
}
-
- public String getServiceId ()
+
+ public String getServiceId()
{
try
{
@@ -148,53 +156,48 @@
catch (Exception ex)
{
ex.printStackTrace();
-
+
return null;
}
}
-
- public void setServiceId (String serviceId)
+
+ public void setServiceId(String serviceId)
{
if (serviceId == null)
throw new IllegalArgumentException();
-
- getAddr().setAddress(INVM_PROTOCOL+"://"+serviceId);
+
+ getAddr().setAddress(INVM_PROTOCOL + "://" + serviceId);
}
-
- public boolean getLockstep ()
+
+ public boolean getLockstep()
{
- if (_lockstep)
- {
- String lockstep = getAddr().getExtensionValue(LOCKSTEP_ENDPOINT_TAG);
-
- if ("true".equalsIgnoreCase(lockstep))
- return true;
- else
- return false;
- }
+ String lockstep = getAddr().getExtensionValue(LOCKSTEP_ENDPOINT_TAG);
+
+ if ("true".equalsIgnoreCase(lockstep))
+ return true;
else
- return false; // default
+ return false;
}
-
- public void setLockstep (boolean lockstep)
+
+ public void setLockstep(boolean lockstep)
{
if (_lockstep)
throw new IllegalStateException("Lockstep already set!");
-
+
if (lockstep)
getAddr().addExtension(LOCKSTEP_ENDPOINT_TAG, "true");
else
getAddr().addExtension(LOCKSTEP_ENDPOINT_TAG, "false");
-
+
_lockstep = true;
}
-
- public long getLockstepWaitTime ()
+
+ public long getLockstepWaitTime()
{
- if (_lockstepTime)
+ String waitTime = getAddr().getExtensionValue(LOCKSTEP_WAIT_TIME_TAG);
+
+ if (waitTime != null)
{
- String waitTime = getAddr().getExtensionValue(LOCKSTEP_WAIT_TIME_TAG);
-
try
{
return Long.parseLong(waitTime);
@@ -202,50 +205,49 @@
catch (Exception ex)
{
ex.printStackTrace();
-
- return DEFAULT_LOCKSTEP_WAIT_TIME;
}
}
- else
- return DEFAULT_LOCKSTEP_WAIT_TIME; // default
+
+ return DEFAULT_LOCKSTEP_WAIT_TIME;
}
-
- public void setLockstepWaitTime (long waitTime)
+
+ public void setLockstepWaitTime(long waitTime)
{
if (_lockstepTime)
throw new IllegalStateException("Lockstep wait time already set!");
-
- getAddr().addExtension(LOCKSTEP_WAIT_TIME_TAG, ""+waitTime);
-
+
+ getAddr().addExtension(LOCKSTEP_WAIT_TIME_TAG, "" + waitTime);
+
_lockstepTime = true;
}
-
- public String toString ()
+
+ public String toString()
{
- return "InVMEpr [ "+super.getAddr().extendedToString()+" ]";
+ return "InVMEpr [ " + super.getAddr().extendedToString() + " ]";
}
-
- public static URI type ()
+
+ public static URI type()
{
- return _type;
+ return _type;
}
-
+
private boolean _lockstep = false;
+
private boolean _lockstepTime = false;
-
+
private static URI _type;
-
+
static
{
- try
+ try
{
- _type = new URI("urn:jboss/esb/epr/type/invm");
+ _type = new URI("urn:jboss/esb/epr/type/invm");
}
catch (Exception ex)
{
- ex.printStackTrace();
-
- throw new ExceptionInInitializerError(ex.toString());
+ ex.printStackTrace();
+
+ throw new ExceptionInInitializerError(ex.toString());
}
}
}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list