1 package org.jacorb.notification.engine; 2 3 22 23 import org.jacorb.notification.interfaces.IProxyPushSupplier; 24 25 29 30 public class WaitRetryStrategy extends AbstractRetryStrategy 31 { 32 public static final long WAIT_TIME_DEFAULT = 1000; 33 34 public static final long WAIT_INCREMENT_DEFAULT = 3000; 35 36 private long currentTimeToWait_; 37 38 private long waitTimeIncrement_; 39 40 42 public WaitRetryStrategy(IProxyPushSupplier pushSupplier, PushOperation pushOperation) 43 { 44 this(pushSupplier, pushOperation, WAIT_TIME_DEFAULT, WAIT_INCREMENT_DEFAULT); 45 } 46 47 public WaitRetryStrategy(IProxyPushSupplier pushSupplier, PushOperation pushOperation, 48 long startingWaitTime, long waitTimeIncrement) 49 { 50 super(pushSupplier, pushOperation); 51 52 currentTimeToWait_ = startingWaitTime; 53 54 waitTimeIncrement_ = waitTimeIncrement; 55 } 56 57 59 protected long getTimeToWait() 60 { 61 long _timeToWait = currentTimeToWait_; 62 63 currentTimeToWait_ += waitTimeIncrement_; 64 65 return _timeToWait; 66 } 67 68 protected void retryInternal() throws RetryException 69 { 70 try 71 { 72 while (isRetryAllowed()) 73 { 74 try 75 { 76 pushOperation_.invokePush(); 77 78 return; 79 } catch (Throwable error) 80 { 81 remoteExceptionOccured(error); 82 } 83 } 84 throw new RetryException("no more retries possible"); 85 } finally 86 { 87 dispose(); 88 } 89 } 90 } 91 | Popular Tags |