weka.gui.boundaryvisualizer
Class BoundaryPanelDistributed

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byweka.gui.boundaryvisualizer.BoundaryPanel
                      extended byweka.gui.boundaryvisualizer.BoundaryPanelDistributed
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class BoundaryPanelDistributed
extends BoundaryPanel

This class extends BoundaryPanel with code for distributing the processing necessary to create a visualization among a list of remote machines. Specifically, a visualization is broken down and processed row by row using the available remote computers.

Since:
1.0
Version:
$Revision: 1.5 $
Author:
Mark Hall
See Also:
BoundaryPanel, Serialized Form

Nested Class Summary
 
Nested classes inherited from class weka.gui.boundaryvisualizer.BoundaryPanel
BoundaryPanel.PlotThread
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static int AVAILABLE
           
protected static int CONNECTION_FAILED
           
protected static int IN_USE
           
private  int m_failedCount
          The count of failed sub-tasks
private  int m_finishedCount
          The count of successfully completed sub-tasks
private  int[] m_hostPollingTime
           
protected  java.util.Vector m_listeners
          a list of RemoteExperimentListeners
private  int m_minTaskPollTime
           
private  boolean m_plottingAborted
          Set to true if MAX_FAILURES exceeded on all hosts or connections fail on all hosts or user aborts plotting
private  int[] m_remoteHostFailureCounts
          The number of times tasks have failed on each remote host
protected  java.util.Vector m_remoteHosts
          Holds the names of machines with remoteEngine servers running
private  Queue m_remoteHostsQueue
          The queue of available hosts
private  int[] m_remoteHostsStatus
          The status of each of the remote hosts
private  int m_removedHosts
          The number of hosts removed due to exceeding max failures
private  Queue m_subExpQueue
          The queue of sub-tasks waiting to be processed
protected static int MAX_FAILURES
           
protected static int SOME_OTHER_FAILURE
           
 
Fields inherited from class weka.gui.boundaryvisualizer.BoundaryPanel
DEFAULT_COLORS, m_classifier, m_Colors, m_dataGenerator, m_maxX, m_maxY, m_minX, m_minY, m_numOfSamplesPerGenerator, m_numOfSamplesPerRegion, m_osi, m_panelHeight, m_panelWidth, m_pixHeight, m_pixWidth, m_plotTrainingData, m_probabilityCache, m_samplesBase, m_stopPlotting, m_stopReplotting, m_trainingData, m_xAttribute, m_yAttribute
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BoundaryPanelDistributed(int panelWidth, int panelHeight)
          Creates a new BoundaryPanelDistributed instance.
 
Method Summary
 void addRemoteExperimentListener(RemoteExperimentListener r)
          Add an object to the list of those interested in recieving update information from the RemoteExperiment
protected  void availableHost(int hostNum)
          Push a host back onto the list of available hosts and launch a waiting Task (if any).
private  boolean checkForAllFailedHosts()
          Check to see if we have failed to connect to all hosts
protected  void incrementFailed(int hostNum)
          Increment the overall number of failures and the number of failures for a particular host
protected  void incrementFinished()
          Increment the number of successfully completed sub experiments
protected  void initialize()
          Set up the off screen bitmap for rendering to
protected  void launchNext(int wtask, int ah)
           
static void main(java.lang.String[] args)
          Main method for testing this class
private  void notifyListeners(boolean status, boolean log, boolean finished, java.lang.String message)
          Inform all listeners of progress
 void setRemoteHosts(java.util.Vector remHosts)
          Set a list of host names of machines to distribute processing to
 void start()
          Start processing
protected  void waitingTask(int expNum)
          Push an experiment back on the queue of waiting experiments
 
Methods inherited from class weka.gui.boundaryvisualizer.BoundaryPanel
addActionListener, computeMinMaxAtts, getColors, getGeneratorSamplesBase, getNumSamplesPerRegion, getPlotTrainingData, plotPoint, plotTrainingData, removeActionListener, replot, saveImage, setClassifier, setColors, setDataGenerator, setGeneratorSamplesBase, setNumSamplesPerRegion, setPlotTrainingData, setTrainingData, setXAttribute, setYAttribute, stopPlotting
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_listeners

protected java.util.Vector m_listeners
a list of RemoteExperimentListeners


m_remoteHosts

protected java.util.Vector m_remoteHosts
Holds the names of machines with remoteEngine servers running


m_remoteHostsQueue

private Queue m_remoteHostsQueue
The queue of available hosts


m_remoteHostsStatus

private int[] m_remoteHostsStatus
The status of each of the remote hosts


m_remoteHostFailureCounts

private int[] m_remoteHostFailureCounts
The number of times tasks have failed on each remote host


AVAILABLE

protected static final int AVAILABLE
See Also:
Constant Field Values

IN_USE

protected static final int IN_USE
See Also:
Constant Field Values

CONNECTION_FAILED

protected static final int CONNECTION_FAILED
See Also:
Constant Field Values

SOME_OTHER_FAILURE

protected static final int SOME_OTHER_FAILURE
See Also:
Constant Field Values

MAX_FAILURES

protected static final int MAX_FAILURES
See Also:
Constant Field Values

m_plottingAborted

private boolean m_plottingAborted
Set to true if MAX_FAILURES exceeded on all hosts or connections fail on all hosts or user aborts plotting


m_removedHosts

private int m_removedHosts
The number of hosts removed due to exceeding max failures


m_failedCount

private int m_failedCount
The count of failed sub-tasks


m_finishedCount

private int m_finishedCount
The count of successfully completed sub-tasks


m_subExpQueue

private Queue m_subExpQueue
The queue of sub-tasks waiting to be processed


m_minTaskPollTime

private int m_minTaskPollTime

m_hostPollingTime

private int[] m_hostPollingTime
Constructor Detail

BoundaryPanelDistributed

public BoundaryPanelDistributed(int panelWidth,
                                int panelHeight)
Creates a new BoundaryPanelDistributed instance.

Parameters:
panelWidth - width of the display
panelHeight - height of the display
Method Detail

setRemoteHosts

public void setRemoteHosts(java.util.Vector remHosts)
Set a list of host names of machines to distribute processing to

Parameters:
remHosts - a Vector of host names (Strings)

addRemoteExperimentListener

public void addRemoteExperimentListener(RemoteExperimentListener r)
Add an object to the list of those interested in recieving update information from the RemoteExperiment

Parameters:
r - a listener

initialize

protected void initialize()
Description copied from class: BoundaryPanel
Set up the off screen bitmap for rendering to

Overrides:
initialize in class BoundaryPanel

start

public void start()
           throws java.lang.Exception
Start processing

Overrides:
start in class BoundaryPanel
Throws:
java.lang.Exception - if an error occurs

availableHost

protected void availableHost(int hostNum)
Push a host back onto the list of available hosts and launch a waiting Task (if any).

Parameters:
hostNum - the number of the host to return to the queue. -1 if no host to return.

notifyListeners

private void notifyListeners(boolean status,
                             boolean log,
                             boolean finished,
                             java.lang.String message)
Inform all listeners of progress

Parameters:
status - true if this is a status type of message
log - true if this is a log type of message
finished - true if the remote task has finished
message - the message.

checkForAllFailedHosts

private boolean checkForAllFailedHosts()
Check to see if we have failed to connect to all hosts


incrementFinished

protected void incrementFinished()
Increment the number of successfully completed sub experiments


incrementFailed

protected void incrementFailed(int hostNum)
Increment the overall number of failures and the number of failures for a particular host

Parameters:
hostNum - the index of the host to increment failure count

waitingTask

protected void waitingTask(int expNum)
Push an experiment back on the queue of waiting experiments

Parameters:
expNum - the index of the experiment to push onto the queue

launchNext

protected void launchNext(int wtask,
                          int ah)

main

public static void main(java.lang.String[] args)
Main method for testing this class

Parameters:
args - a String[] value