All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.notuvy.singleapp.AbstractSingleApp Maven / Gradle / Ivy

Go to download

A simple Java framework for making applications singletons. The underlying mechanism uses interprocess communication to that at most one application process is active at a time. A new application invocation either displaces a previous invocation, or it defers to the previous and terminates itself.

There is a newer version: 2.1
Show newest version
/*
   Copyright 2007-2009 Murali Krishnan

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

package com.notuvy.singleapp;

import java.io.Serializable;

/**
 * The trivial implementation of a single instance application.
 * An actual implementation would extend this class and override the stubbed methods.
 *
 * @author  murali
 */
public abstract class AbstractSingleApp implements SingleApp {

    //------------------------------------------------------------
    //- Class Variables


    //------------------------------------------------------------
    //- Class Functions


    //------------------------------------------------------------
    //- Instance Variables


    //------------------------------------------------------------
    //- Constructors


    //------------------------------------------------------------
    //- Accessors


    //------------------------------------------------------------
    //- Settors


    //------------------------------------------------------------
    //- Private/Protected Utility Functions


    //------------------------------------------------------------
    //- Public Interface Functions

    public void launchPreempt(int pPort) {
        SingleAppEnforcer.preempt(pPort, this);
    }


    public void launchDefer(int pPort) {
        SingleAppEnforcer.defer(pPort, this);
    }


    //------------------------------------------------------------
    //- Class Interface Functions



    //------------------------------------------------------------
    //- Inner Classes

    public Serializable sendFromDeferred() {
        return null;
    }

    public void recvFromDeferred(Object pObject) {
    }

    public Serializable sendToPreemptor() {
        return null;
    }

    public void recvFromPreempted(Object pObject) {
    }

    public void gracefulExitForPreempt() {
    }

    //------------------------------------------------------------
    //- Main



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy