Author: slaws
Date: Mon Mar 17 08:10:55 2008
New Revision: 637931
URL: http://svn.apache.org/viewvc?rev=637931&view=rev
Log:
TUSCANY-2088
Prevent the client side from testing for conversation time outs if the call is
across a remote wire. In this case the conversation object will not have the
correct timeout properties as they are only available to the remote service.
Modified:
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
Modified:
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java?rev=637931&r1=637930&r2=637931&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
(original)
+++
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
Mon Mar 17 08:10:55 2008
@@ -100,25 +100,30 @@
* will check whether this conversation has expired and update state if it
has
* @return true if it has expired
*/
- public boolean isExpired()
- {
- long currentTime;
- synchronized (stateSync){
-
- // check state first
- if (state == ConversationState.EXPIRED){
- return true;
- }
-
- // check whether the time is finished
- currentTime = System.currentTimeMillis();
- if (((this.lastReferencedTime + this.maxIdleTime) <=
currentTime) ||
- (this.expirationTime <= currentTime)){
- setState(ConversationState.EXPIRED);
- return true;
- }
- }
- scheduleNextExpiryTime(currentTime);
+ public boolean isExpired() {
+ long currentTime;
+ synchronized (stateSync) {
+
+ // if the attributes haven't been initialized then
+ // this conversation object can't expire
+ if (conversationAttributesInitialized == false) {
+ return false;
+ }
+
+ // check state first
+ if (state == ConversationState.EXPIRED) {
+ return true;
+ }
+
+ // check whether the time is finished
+ currentTime = System.currentTimeMillis();
+ if (((this.lastReferencedTime + this.maxIdleTime) <= currentTime)
+ || (this.expirationTime <= currentTime)) {
+ setState(ConversationState.EXPIRED);
+ return true;
+ }
+ }
+ scheduleNextExpiryTime(currentTime);
return false;
}
Modified:
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java?rev=637931&r1=637930&r2=637931&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
(original)
+++
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
Mon Mar 17 08:10:55 2008
@@ -365,15 +365,27 @@
if (conversation == null || conversation.getState() ==
ConversationState.ENDED) {
conversation =
conversationManager.startConversation(getConversationID());
-
conversation.initializeConversationAttributes(wire.getTarget().getComponent());
+
+ // if this is a local wire then set up the conversation timeouts
here based on the
+ // parameters from the component
+ if (wire.getTarget().getComponent() != null){
+
conversation.initializeConversationAttributes(wire.getTarget().getComponent());
+ }
+
+ // connect the conversation to the callable reference so it can be
retrieve in the future
if (callableReference != null) {
((CallableReferenceImpl)callableReference).attachConversation(conversation);
}
} else if (conversation.isExpired()) {
- throw new ConversationEndedException("Conversation has expired.");
+ throw new ConversationEndedException("Conversation " +
conversation.getConversationID() + " has expired.");
}
- conversation.updateLastReferencedTime();
+ // if this is a local wire then schedule conversation timeouts based
on the timeout
+ // parameters from the service implementation. If this isn't a local
wire then
+ // the RuntimeWireInvker will take care of this
+ if (wire.getTarget().getComponent() != null){
+ conversation.updateLastReferencedTime();
+ }
msg.getFrom().getReferenceParameters().setConversationID(conversation.getConversationID());
Modified:
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java?rev=637931&r1=637930&r2=637931&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
(original)
+++
incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
Mon Mar 17 08:10:55 2008
@@ -161,8 +161,7 @@
conversation.initializeConversationAttributes(wire.getTarget().getComponent());
} else if (conversation.conversationalAttributesInitialized() ==
false) {
conversation.initializeConversationAttributes(wire.getTarget().getComponent());
- }
- else if (conversation.isExpired()){
+ } else if (conversation.isExpired()){
throw new ConversationEndedException("Conversation has
expired.");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]