[ 
https://issues.apache.org/jira/browse/MUSE-237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bo Shao updated MUSE-237:
-------------------------

    Attachment: SimpleScheduledTermination.java

As suggested by Vinh Nguyen, I made modifications in the following 4 places:
1. Originally, set _terminationTimer to null;
2. In getTerminationTime(), check if it is null. If it is null, then return 
null;
3. In setTerminationTime(Date time). Firstly check the input value time, if it 
is null, then return null. Then I check if _terminationTimer has been 
initialized or not. If not, then initialize it. And keep all other cases.
4. In shutdown(), I also check if _terminationTimer is null or not. If it is 
not null, then cancel it.

I attached the modified version of SimpleScheduledTermination.java in this 
post. Thanks!

> Cannot set subscription termination time if Subscribe was first called with 
> null time
> -------------------------------------------------------------------------------------
>
>                 Key: MUSE-237
>                 URL: https://issues.apache.org/jira/browse/MUSE-237
>             Project: Muse
>          Issue Type: Bug
>         Environment: Muse 2.2.0, Eclipse 3.2.1
>            Reporter: Vinh Nguyen
>            Assignee: Dan Jemiolo
>         Attachments: SimpleScheduledTermination.java
>
>
> I initially subscribe with no expiration date.  This means the subscription 
> lifetime is indefinite.  But later, when I try to call the 
> setTerminationTime() to give the subscription a specific expiration date, I 
> get the following error:
> org.apache.muse.ws.addressing.soap.SoapFault: Timer already cancelled.
>       at 
> org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.java:298)
>       at 
> com.cisco.nm.cmp.nbi.wsdm.client.core.SubscriptionClient.invoke(SubscriptionClient.java:126)
>       at 
> org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.java:254)
>       at 
> org.apache.muse.ws.resource.remote.WsResourceClient.setTerminationTime(WsResourceClient.java:187)
> The error is in SimpleScheduledTermination line #114. 
> The SimpleNotificationProducer.subscribe() is invoked by the client with a 
> null expiration date.  This creates the SimpleScheduledTermination instance 
> and calls setTerminationTime(null), which cancels the internal timer.  Later, 
> when setTerminationTime() is called with a valid date, the Timer throws an 
> error because a task is trying to be scheduled on it, but the timer already 
> was cancelled.
> The simplest fix is to set a flag so that if the timer was initially 
> cancelled, reinstantiate it when it's used again.  The flag can be set in 
> SimpleScheduledTermination time.  Or better, create it in 
> org.apache.muse.util.Timer so that you know if it was cancelled, and check 
> this flag in SimpleScheduledTermination.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to