001/*
002 * jPOS Project [http://jpos.org]
003 * Copyright (C) 2000-2026 jPOS Software SRL
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jpos.space;
020
021import java.io.Serializable;
022import java.rmi.Remote;
023import java.rmi.RemoteException;
024
025/**
026 * RMI based Space proxy
027 *
028 * @author Alejandro Revilla
029 * @version $Revision$ $Date$
030 * @since 2.0
031 * @see Space
032 */
033
034public interface RemoteSpace extends Remote {
035
036    /**
037     * Write a new entry into the Space
038     * @param key Entry's key
039     * @param value Object value
040     * @throws RemoteException
041     */
042    void out(Serializable key, Serializable value)
043        throws RemoteException;
044
045
046    /**
047     * Write a new leased entry into the Space. Entry will remain valid
048     * for a limited amount of time.
049     * @param key Entry's key
050     * @param value Object value
051     * @param timeout entry valid time
052     * @throws RemoteException
053     */
054    void out(Serializable key, Serializable value, long timeout)
055        throws RemoteException;
056
057    /**
058     * Take an entry from the space, waiting forever until one exists.
059     * @param key Entry's key
060     * @return value
061     * @throws RemoteException
062     */
063    Serializable in(Serializable key)
064        throws RemoteException;
065
066    /**
067     * Read an entry from the space, waiting forever until one exists.
068     * @param key Entry's key
069     * @return value
070     * @throws RemoteException
071     */
072    Serializable rd(Serializable key)
073        throws RemoteException;
074
075    /**
076     * Take an entry from the space, waiting a limited amount of time
077     * until one exists.
078     * @param key Entry's key
079     * @param timeout millis to wait
080     * @return value or null
081     * @throws RemoteException
082     */
083    Serializable in(Serializable key, long timeout)
084        throws RemoteException;
085
086
087    /**
088     * Read an entry from the space, waiting a limited amount of time
089     * until one exists.
090     * @param key Entry's key
091     * @param timeout millis to wait
092     * @return value or null
093     * @throws RemoteException
094     */
095    Serializable rd(Serializable key, long timeout)
096        throws RemoteException;
097
098    /**
099     * In probe takes an entry from the space if one exists, 
100     * return null otherwise.
101     * @param key Entry's key
102     * @return value or null
103     * @throws RemoteException
104     */
105    Serializable inp(Serializable key)
106        throws RemoteException;
107
108    /**
109     * Read probe reads an entry from the space if one exists, 
110     * return null otherwise.
111     * @param key Entry's key
112     * @return value or null
113     * @throws RemoteException
114     */
115    Serializable rdp(Serializable key)
116        throws RemoteException;
117
118}
119