Author: hadrian
Date: Wed Jan 16 03:44:41 2013
New Revision: 1433816
URL: http://svn.apache.org/viewvc?rev=1433816&view=rev
Log:
ODE-987. Replace explicit use of Channel export with helper call (step 2)
Modified:
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
ode/trunk/jacob/src/main/java/org/apache/ode/jacob/ProcessUtil.java
ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
Modified:
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=1433816&r1=1433815&r2=1433816&view=diff
==============================================================================
---
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
(original)
+++
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
Wed Jan 16 03:44:41 2013
@@ -101,6 +101,7 @@ import org.apache.ode.bpel.runtime.chann
import org.apache.ode.bpel.runtime.channels.PickResponseChannel;
import org.apache.ode.bpel.runtime.channels.TimerResponseChannel;
import org.apache.ode.jacob.JacobRunnable;
+import org.apache.ode.jacob.ProcessUtil;
import org.apache.ode.jacob.vpu.ExecutionQueueImpl;
import org.apache.ode.jacob.vpu.JacobVPU;
import org.apache.ode.utils.DOMUtils;
@@ -344,7 +345,7 @@ public class BpelRuntimeContextImpl impl
sendEvent(evt);
}
- final String pickResponseChannelStr = pickResponseChannel.export();
+ final String pickResponseChannelStr =
ProcessUtil.exportChannel(pickResponseChannel);
List<CorrelatorDAO> correlators = new
ArrayList<CorrelatorDAO>(selectors.length);
for (Selector selector : selectors) {
@@ -403,7 +404,7 @@ public class BpelRuntimeContextImpl impl
CorrelatorDAO correlator = correlators.get(i);
Selector selector = selectors[i];
- correlator.addRoute(pickResponseChannel.export(), _dao, i,
selector.correlationKeySet, selector.route);
+
correlator.addRoute(ProcessUtil.exportChannel(pickResponseChannel), _dao, i,
selector.correlationKeySet, selector.route);
scheduleCorrelatorMatcher(correlator.getCorrelatorId(),
selector.correlationKeySet);
if (BpelProcess.__log.isDebugEnabled()) {
@@ -660,7 +661,7 @@ public class BpelRuntimeContextImpl impl
public void registerTimer(TimerResponseChannel timerChannel, Date
timeToFire) {
JobDetails we = new JobDetails();
we.setInstanceId(_dao.getInstanceId());
- we.setChannel(timerChannel.export());
+ we.setChannel(ProcessUtil.exportChannel(timerChannel));
we.setType(JobType.TIMER);
we.setInMem(_bpelProcess.isInMemory());
if(_bpelProcess.isInMemory()){
@@ -740,7 +741,7 @@ public class BpelRuntimeContextImpl impl
mexDao.setInstance(_dao);
mexDao.setPattern((operation.getOutput() != null ?
MessageExchangePattern.REQUEST_RESPONSE
: MessageExchangePattern.REQUEST_ONLY).toString());
- mexDao.setChannel(channel == null ? null : channel.export());
+ mexDao.setChannel(channel == null ? null :
ProcessUtil.exportChannel(channel));
// Properties used by stateful-exchange protocol.
String mySessionId = plinkDAO.getMySessionId();
@@ -1006,7 +1007,7 @@ public class BpelRuntimeContextImpl impl
public void cancel(final TimerResponseChannel timerResponseChannel) {
// In case this is a pick response channel, we need to cancel routes
and
// receive/reply association.
- final String id = timerResponseChannel.export();
+ final String id = ProcessUtil.exportChannel(timerResponseChannel);
_dao.getProcess().removeRoutes(id, _dao);
_imaManager.cancel(id, true);
@@ -1365,12 +1366,12 @@ public class BpelRuntimeContextImpl impl
if (dateTime == null)
dateTime = new Date();
__log.info("ActivityRecovery: Registering activity " + activityId + ",
failure reason: " + reason +
- " on channel " + channel.export());
- _dao.createActivityRecovery(channel.export(), (int) activityId,
reason, dateTime, details, actions, retries);
+ " on channel " + ProcessUtil.exportChannel(channel));
+ _dao.createActivityRecovery(ProcessUtil.exportChannel(channel), (int)
activityId, reason, dateTime, details, actions, retries);
}
public void unregisterActivityForRecovery(ActivityRecoveryChannel channel)
{
- _dao.deleteActivityRecovery(channel.export());
+ _dao.deleteActivityRecovery(ProcessUtil.exportChannel(channel));
}
public void recoverActivity(final String channel, final long activityId,
final String action, final FaultData fault) {
Modified:
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java?rev=1433816&r1=1433815&r2=1433816&view=diff
==============================================================================
---
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java
(original)
+++
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java
Wed Jan 16 03:44:41 2013
@@ -51,6 +51,7 @@ import org.apache.ode.bpel.runtime.chann
import org.apache.ode.bpel.runtime.channels.PickResponseChannel;
import org.apache.ode.bpel.runtime.channels.TimerResponseChannel;
import org.apache.ode.jacob.JacobRunnable;
+import org.apache.ode.jacob.ProcessUtil;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.ObjectPrinter;
@@ -81,7 +82,7 @@ public class ReplayerBpelRuntimeContextI
@Override
public void cancel(TimerResponseChannel timerResponseChannel) {
if (__log.isDebugEnabled()) {
- __log.debug("cancel " + timerResponseChannel.export());
+ __log.debug("cancel " +
ProcessUtil.exportChannel(timerResponseChannel));
}
super.cancel(timerResponseChannel);
}
@@ -157,7 +158,7 @@ public class ReplayerBpelRuntimeContextI
throw new IllegalStateException("I don't have response for
invoke " + answer);
}
- final String channel2 = channel.export();
+ final String channel2 = ProcessUtil.exportChannel(channel);
final String mexid = mexDao.getMessageExchangeId();
replayerContext.scheduler.scheduleReplayerJob(new Callable() {
public Object call() throws Exception {
@@ -195,7 +196,7 @@ public class ReplayerBpelRuntimeContextI
@Override
public void registerTimer(final TimerResponseChannel timerChannel, final
Date timeToFire) {
__log.debug("register timer " + timerChannel + " " + timeToFire);
- final String channel = timerChannel.export();
+ final String channel = ProcessUtil.exportChannel(timerChannel);
if (timeToFire.before(replayerContext.replayStartDate)) {
replayerContext.scheduler.scheduleReplayerJob(new Callable() {
Modified:
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java?rev=1433816&r1=1433815&r2=1433816&view=diff
==============================================================================
---
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
(original)
+++
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
Wed Jan 16 03:44:41 2013
@@ -39,6 +39,7 @@ import org.apache.ode.bpel.runtime.chann
import org.apache.ode.bpel.runtime.channels.Termination;
import org.apache.ode.bpel.runtime.channels.TerminationChannel;
import org.apache.ode.jacob.ChannelListener;
+import org.apache.ode.jacob.ProcessUtil;
import org.apache.ode.jacob.ReceiveProcess;
import org.apache.ode.jacob.SynchChannel;
import org.w3c.dom.Element;
@@ -275,7 +276,7 @@ class EH_EVENT extends BpelJacobRunnable
partnersSessionId);
}
-
getBpelRuntimeContext().cancelOutstandingRequests(_pickResponseChannel.export());
+
getBpelRuntimeContext().cancelOutstandingRequests(ProcessUtil.exportChannel(_pickResponseChannel));
// this request is now waiting for a reply
getBpelRuntimeContext().processOutstandingRequest(_scopeFrame.resolve(_oevent.partnerLink),
_oevent.operation.getName(),
_oevent.messageExchangeId, mexId);
Modified:
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
URL:
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java?rev=1433816&r1=1433815&r2=1433816&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
(original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
Wed Jan 16 03:44:41 2013
@@ -44,6 +44,7 @@ import org.apache.ode.bpel.runtime.chann
import org.apache.ode.bpel.runtime.channels.PickResponse;
import org.apache.ode.bpel.runtime.channels.PickResponseChannel;
import org.apache.ode.bpel.runtime.channels.Termination;
+import org.apache.ode.jacob.ProcessUtil;
import org.apache.ode.jacob.ReceiveProcess;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.xsd.Duration;
@@ -295,7 +296,7 @@ class PICK extends ACTIVITY {
dpe(_alarm.activity);
}
-
getBpelRuntimeContext().cancelOutstandingRequests(_pickResponseChannel.export());
+
getBpelRuntimeContext().cancelOutstandingRequests(ProcessUtil.exportChannel(_pickResponseChannel));
FaultData fault;
initVariable(mexId, onMessage);
Modified: ode/trunk/jacob/src/main/java/org/apache/ode/jacob/ProcessUtil.java
URL:
http://svn.apache.org/viewvc/ode/trunk/jacob/src/main/java/org/apache/ode/jacob/ProcessUtil.java?rev=1433816&r1=1433815&r2=1433816&view=diff
==============================================================================
--- ode/trunk/jacob/src/main/java/org/apache/ode/jacob/ProcessUtil.java
(original)
+++ ode/trunk/jacob/src/main/java/org/apache/ode/jacob/ProcessUtil.java Wed Jan
16 03:44:41 2013
@@ -25,10 +25,10 @@ public final class ProcessUtil {
}
public static String exportChannel(ChannelType channel) {
- if (channel instanceof Channel) {
+ if (channel != null && channel instanceof Channel) {
return ((Channel)channel).export();
}
- // TODO: add a check for null?
- throw new RuntimeException("Invalid proxy type " + channel.getClass());
+ throw new IllegalArgumentException("Invalid proxy type: "
+ + channel == null ? "<null>" : channel.getClass().toString());
}
}
Modified:
ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
URL:
http://svn.apache.org/viewvc/ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java?rev=1433816&r1=1433815&r2=1433816&view=diff
==============================================================================
---
ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
(original)
+++
ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
Wed Jan 16 03:44:41 2013
@@ -23,6 +23,8 @@ import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import org.apache.ode.jacob.Channel;
+import org.apache.ode.jacob.ChannelType;
+import org.apache.ode.jacob.ProcessUtil;
import junit.framework.TestCase;
@@ -37,7 +39,7 @@ public class ProxyConstructorTimingTest
Greeter gp = (Greeter)
Proxy.newProxyInstance(Greeter.class.getClassLoader(),
new Class<?>[] {Channel.class, Greeter.class}, new
GreeterInvocationHandler(new GreeterImpl()));
assertEquals("Hello World", gp.hello("World"));
- assertEquals("Implemented by InvocationHandler",
((Channel)gp).export());
+ assertEquals("Implemented by InvocationHandler",
ProcessUtil.exportChannel(gp));
}
public interface TestExecution {
@@ -104,17 +106,19 @@ public class ProxyConstructorTimingTest
});
}
- public interface Greeter {
+ public interface Greeter extends ChannelType {
String hello(String name);
}
- public class GreeterImpl implements Greeter {
+ @SuppressWarnings("serial")
+ public class GreeterImpl implements Greeter {
public String hello(String name) {
return "Hello " + name;
}
}
- public class GreeterImpl2 implements Greeter {
+ @SuppressWarnings("serial")
+ public class GreeterImpl2 implements Greeter {
public String hello(String name) {
return "";
}