    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.jigsaw.resources.CheckpointResource

    java.lang.Object
       |
       +----org.w3c.tools.resources.AttributeHolder
               |
               +----org.w3c.tools.resources.Resource
                       |
                       +----org.w3c.tools.resources.FramedResource
                               |
                               +----org.w3c.jigsaw.resources.CheckpointResource

public class CheckpointResource
extends FramedResource
implements Runnable

A resource that will checkpoint the configuration at regular intervals. This resource will make sure that current configuration is backed up to disk at regular (configurable) intervals.

The webmaster can customize what part of the configuration is to be backed up through boolean attributes.

##

alive
  Is our attached thread still alive ?
ATTR_FLUSHCONFIG
  Attribute index - Should we save the configuration ?
ATTR_FLUSHLOG
  Attribute index - Should we flush the logs too ?
ATTR_FLUSHPROPS
  Attrbute index - Should we save the properties too ?
ATTR_INTERVAL
  Attribute index - Backup interval, in seconds.
ATTR_PRIORITY
  Attribute index - The priority of the flusher thread.
ATTR_TRACE_CHECK
  Attribute index - should we display a trace when we perform checkpoint
checkpoint
  Last date at which we checkpointed the configuration
thread
  Our thread, if one is currently attached.

##

CheckpointResource()

##

acceptUnload()
  This is the only resource that will refuse to be unloaded !
activate()
  Start the thread for this object, only if needed.
getFlushConfiguration()
  Get the flush configuration flag.
getFlushLog()
  Get the flush log flag.
getFlushProperties()
  Get the flush properties flag.
getInterval()
  Get the sync interval.
getPriority()
  Get the priority for our attached thread.
getTraceFlag()
initialize(Object[])
  Activate the checkpointer at initialization time.
notifyUnload()
  This resource is being unloaded.
run()
  We are attached a thread, now it's time to performt the job.
stop()
  Force our attached thread to stop.

##

ATTR_INTERVAL

     protected static int ATTR_INTERVAL

  Attribute index - Backup interval, in seconds.

ATTR_PRIORITY

     protected static int ATTR_PRIORITY

  Attribute index - The priority of the flusher thread.

ATTR_FLUSHLOG

     protected static int ATTR_FLUSHLOG

  Attribute index - Should we flush the logs too ?

ATTR_FLUSHPROPS

     protected static int ATTR_FLUSHPROPS

  Attrbute index - Should we save the properties too ?

ATTR_FLUSHCONFIG

     protected static int ATTR_FLUSHCONFIG

  Attribute index - Should we save the configuration ?

ATTR_TRACE_CHECK

     protected static int ATTR_TRACE_CHECK

  Attribute index - should we display a trace when we perform checkpoint

thread

     protected Thread thread

  Our thread, if one is currently attached.

checkpoint

     protected Date checkpoint

  Last date at which we checkpointed the configuration

alive

     protected boolean alive

  Is our attached thread still alive ?

##

CheckpointResource

     public CheckpointResource()

##

activate

     public synchronized void activate()

  Start the thread for this object, only if needed.

stop

     protected synchronized void stop()

  Force our attached thread to stop.

getInterval

     public int getInterval()

  Get the sync interval.

  Returns:
    An integer number of seconds, or -1 if undefined.

getPriority

     public int getPriority()

  Get the priority for our attached thread.

  Returns:
    An integer priority for the thread, which defaults to 2 if undefined.

getFlushLog

     public boolean getFlushLog()

  Get the flush log flag.

  Returns:
    A boolean, true if the log is to be flushed at each refresh interval, false otherwise.

getTraceFlag

     public boolean getTraceFlag()

getFlushProperties

     public boolean getFlushProperties()

  Get the flush properties flag.

  Returns:
    A boolean, true if the properties are to be flushed, false otherwise.

getFlushConfiguration

     public boolean getFlushConfiguration()

  Get the flush configuration flag.

  Returns:
    A boolean, true oif the configuration is to be flushed at each interval, false otherwise.

acceptUnload

     public boolean acceptUnload()

  This is the only resource that will refuse to be unloaded !

  Returns:
    Always false.
  Overrides:
    acceptUnload in class Resource

notifyUnload

     public void notifyUnload()

  This resource is being unloaded. Unloading that object will also stop the thread. However, there is a bug here, since if the resource gets unloaded for some reason, it will not be able to wakeup itself at next checkpoint time.

  Overrides:
    notifyUnload in class FramedResource

run

     public void run()

  We are attached a thread, now it's time to performt the job.

initialize

     public void initialize(Object values[])

  Activate the checkpointer at initialization time.

  Overrides:
    initialize in class FramedResource

    All Packages  Class Hierarchy  This Package  Previous  Next  Index