org.jgroups.protocols

## Class BSH

- java.lang.Object
- - org.jgroups.stack.Protocol
  - - org.jgroups.protocols.BSH

- All Implemented Interfaces:
    java.lang.Runnable

      public class BSH
      extends Protocol
      implements java.lang.Runnable

  Beanshell (www.beanshell.org) interpreter class. The `eval()` method receives Java code, executes it and returns the result of the evaluation (or an exception).

  This protocol is experimental User: Bela Date: Mar 8, 2003 Time: 1:57:07 PM
  Author:
    Bela Ban

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Thread` | `acceptor`
    `protected bsh.Interpreter` | `interpreter`
    `protected java.util.List<java.net.Socket>` | `sockets`
    `protected java.net.ServerSocket` | `srv_sock`

    - ### Fields inherited from class org.jgroups.stack.Protocol

      `down_prot, ergonomics, id, log, name, stack, stats, up_prot`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BSH()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `run()`
    `void` | `start()` This method is called on a `Channel.connect(String)`.
    `void` | `stop()` This method is called on a `Channel.disconnect()`.

    - ### Methods inherited from class org.jgroups.stack.Protocol

      `destroy, down, downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, init, isErgonomics, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, up, upThreadEnabled`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### interpreter

          protected bsh.Interpreter interpreter

    - #### srv_sock

          protected java.net.ServerSocket srv_sock

    - #### acceptor

          protected java.lang.Thread acceptor

    - #### sockets

          protected final java.util.List<java.net.Socket> sockets

  - ### Constructor Detail

    - #### BSH

          public BSH()

  - ### Method Detail

    - #### start

          public void start()
                     throws java.lang.Exception

      Description copied from class: `Protocol`
      This method is called on a `Channel.connect(String)`. Starts work. Protocols are connected and queues are ready to receive events. Will be called from bottom to top. This call will replace the START and START_OK events.
      Overrides:
        `start` in class `Protocol`
      Throws:
        `java.lang.Exception` - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so `Channel.connect(String)` will throw an exception

    - #### stop

          public void stop()

      Description copied from class: `Protocol`
      This method is called on a `Channel.disconnect()`. Stops work (e.g. by closing multicast socket). Will be called from top to bottom. This means that at the time of the method invocation the neighbor protocol below is still working. This method will replace the STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that when this method is called all messages in the down queue will have been flushed
      Overrides:
        `stop` in class `Protocol`

    - #### run

          public void run()

      Specified by:
        `run` in interface `java.lang.Runnable`

Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.