Class ServerWrapper

java.lang.Object
de.iip_ecosphere.platform.services.ServerWrapper
All Implemented Interfaces:
de.iip_ecosphere.platform.support.Server

public class ServerWrapper extends Object implements de.iip_ecosphere.platform.support.Server
Wraps a Server into a thread if considered necessary. A wrapped threaded server may fail more easily than a direct instance controlled by a service manager, while a threaded server also allocates more resources if the server itself creates a thread.
Author:
Holger Eichelberger, SSE
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean
     
    private de.iip_ecosphere.platform.support.Server
     
    private Thread
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ServerWrapper(de.iip_ecosphere.platform.support.Server server)
    Creates a server wrapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    Returns whether a wrapping thread is needed or the server shall be called as delegate.
    de.iip_ecosphere.platform.support.Server
     
    void
    stop(boolean dispose)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • server

      private de.iip_ecosphere.platform.support.Server server
    • thread

      private Thread thread
    • running

      private boolean running
  • Constructor Details

    • ServerWrapper

      public ServerWrapper(de.iip_ecosphere.platform.support.Server server)
      Creates a server wrapper.
      Parameters:
      server - the server instance
  • Method Details

    • requiresThread

      protected boolean requiresThread()
      Returns whether a wrapping thread is needed or the server shall be called as delegate.
      Returns:
      true if a thread is required, false else
    • start

      public de.iip_ecosphere.platform.support.Server start()
      Specified by:
      start in interface de.iip_ecosphere.platform.support.Server
    • stop

      public void stop(boolean dispose)
      Specified by:
      stop in interface de.iip_ecosphere.platform.support.Server