net.sourceforge.rssowl.controller.thread
Class StartupManager

java.lang.Object
  extended by net.sourceforge.rssowl.controller.thread.StartupManager

public class StartupManager
extends java.lang.Object

Only allow one instance of RSSOwl running at the same time.

The StartupManager is a small server that is using Sockets to listen on a port. Whenever an instance of RSSOwl is starting, the server is started. In case another instance is already running the server, a message is passed to it. The server will then restore the running RSSOwl from taskbar or tray.

Version:
1.2.4
Author:
Benjamin Pasero

Field Summary
(package private) static java.net.ServerSocket applLockSocket
           
private static java.lang.String DEFAULT_MESSAGE
           
private static java.lang.String LOCALHOST
           
private static int RSSOWL_SOCKET_PORT
           
private static ExtendedThread server
           
 
Constructor Summary
StartupManager()
           
 
Method Summary
private static void handleSocketBound(java.lang.String message)
          Server already running.
private static void handleSocketUnBound()
          Server not yet running.
static boolean isRSSOwlRunning(java.lang.String message)
          Check wether RSSOwl is already running by trying to start the Server.
private static void listen()
          Listen for incoming messages.
static void stopServer()
          Stop the Server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALHOST

private static final java.lang.String LOCALHOST
See Also:
Constant Field Values

RSSOWL_SOCKET_PORT

private static final int RSSOWL_SOCKET_PORT
See Also:
Constant Field Values

server

private static ExtendedThread server

DEFAULT_MESSAGE

private static final java.lang.String DEFAULT_MESSAGE
See Also:
Constant Field Values

applLockSocket

static java.net.ServerSocket applLockSocket
Constructor Detail

StartupManager

public StartupManager()
Method Detail

isRSSOwlRunning

public static boolean isRSSOwlRunning(java.lang.String message)
Check wether RSSOwl is already running by trying to start the Server. In case RSSOwl is already running, a message is passed to the Server of that instance.

Parameters:
message - A message passed in from the starting application.
Returns:
boolean TRUE if RSSOwl is already running, false otherwise.

stopServer

public static void stopServer()
Stop the Server.


handleSocketBound

private static void handleSocketBound(java.lang.String message)
Server already running. Pass a message to the running Server.

Parameters:
message - A message passed in from the starting application.

handleSocketUnBound

private static void handleSocketUnBound()
Server not yet running. Start it and listen for incoming messages.


listen

private static void listen()
Listen for incoming messages.



RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo