com.sun.sgs.impl.kernel
Class ScheduledTaskImpl.Builder

java.lang.Object
  extended by com.sun.sgs.impl.kernel.ScheduledTaskImpl.Builder
Enclosing class:
ScheduledTaskImpl

static class ScheduledTaskImpl.Builder
extends Object

We use the builder pattern here to avoid constructor explosion. This builder takes three required parameters, task, owner, and priority and then provides setter methods for each of the remaining optional parameters for building a ScheduledTaskImpl object.

Example usage:

 ScheduledTaskImpl task = new ScheduledTaskImpl.Builder(
     task, owner, priority).period(1000).build();
 


Constructor Summary
ScheduledTaskImpl.Builder(KernelRunnable task, Identity owner, Priority priority)
          Constructs a Builder object that takes three required parameters for building a ScheduledTaskImpl.
ScheduledTaskImpl.Builder(ScheduledTaskImpl task)
          Constructs a Builder object to build a ScheduledTaskImpl object with all of the same values as the given task except for the startTime, timeout, and maxConcurrency which are set to their default values.
 
Method Summary
(package private)  ScheduledTaskImpl build()
          Builds a ScheduledTaskImpl object from the attributes in this builder.
(package private)  ScheduledTaskImpl.Builder period(long period)
          Setter for setting the period of a new ScheduledTaskImpl
(package private) static void setDefaultTimeout(long timeout)
          Set the default value of timeout for new instances of ScheduledTaskImpl built with a builder.
(package private)  ScheduledTaskImpl.Builder startTime(long startTime)
          Setter for setting the start time of a new ScheduledTaskImpl.
(package private)  ScheduledTaskImpl.Builder timeout(long timeout)
          Setter for setting the timeout of a new ScheduledTaskImpl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScheduledTaskImpl.Builder

ScheduledTaskImpl.Builder(KernelRunnable task,
                          Identity owner,
                          Priority priority)
Constructs a Builder object that takes three required parameters for building a ScheduledTaskImpl.

Parameters:
task - the KernelRunnable to run
owner - the Identity of the task owner
priority - the Priority of the task

ScheduledTaskImpl.Builder

ScheduledTaskImpl.Builder(ScheduledTaskImpl task)
Constructs a Builder object to build a ScheduledTaskImpl object with all of the same values as the given task except for the startTime, timeout, and maxConcurrency which are set to their default values.

Parameters:
task - existing ScheduledTaskImpl
Method Detail

startTime

ScheduledTaskImpl.Builder startTime(long startTime)
Setter for setting the start time of a new ScheduledTaskImpl.

Parameters:
startTime - the time at which to start in milliseconds since January 1, 1970
Returns:
this Builder object

period

ScheduledTaskImpl.Builder period(long period)
Setter for setting the period of a new ScheduledTaskImpl

Parameters:
period - the delay between recurring executions, or NON_RECURRING
Returns:
this Builder object

timeout

ScheduledTaskImpl.Builder timeout(long timeout)
Setter for setting the timeout of a new ScheduledTaskImpl

Parameters:
timeout - the transaction timeout to use for this task or UNBOUNDED
Returns:
this Builder object

setDefaultTimeout

static void setDefaultTimeout(long timeout)
Set the default value of timeout for new instances of ScheduledTaskImpl built with a builder.

Parameters:
timeout - default value of timeout

build

ScheduledTaskImpl build()
Builds a ScheduledTaskImpl object from the attributes in this builder.

Returns:
a ScheduledTaskImpl object

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved