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

Vinh Nguyen commented on MUSE-237:
----------------------------------

Another possible fix is to initially have the Timer set to null.  Then in 
setTerminationTime(), do this:
// If time is null, just return it.
// Else, if the timer task wasn't initialized, make a new one.
// Else, stop the current timer task and make a new one.

You'd also have to update getTerminationTime() and shutdown() to check for a 
null Timer before calling methods on it.

> 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
>
> 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