Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* This file is part of GraphStream .
*
* GraphStream is a library whose purpose is to handle static or dynamic
* graph, create them from scratch, file or any source and display them.
*
* This program is free software distributed under the terms of two licenses, the
* CeCILL-C license that fits European law, and the GNU Lesser General Public
* License. You can use, modify and/ or redistribute the software under the terms
* of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
* URL or under the terms of the GNU LGPL as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C and LGPL licenses and that you accept their terms.
*/
/**
* @since 2009-07-04
*
* @author Yoann Pigné
* @author Antoine Dutot
* @author Guilhelm Savin
* @author Stefan Balev
* @author Alex Bowen
* @author Hicham Brahimi
*/
package org.graphstream.stream.thread;
import org.graphstream.graph.Graph;
import org.graphstream.stream.ProxyPipe;
import org.graphstream.stream.Replayable;
import org.graphstream.stream.Replayable.Controller;
import org.graphstream.stream.Sink;
import org.graphstream.stream.Source;
import org.graphstream.stream.SourceBase;
import java.util.LinkedList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Logger;
/**
* Filter that allows to pass graph events between two threads without explicit
* synchronization.
*
*
* This filter allows to register it as an output for some source of events in a
* source thread (hereafter called the input thread) and to register listening
* outputs in a destination thread (hereafter called the sink thread).
*
* In other words, this class allows to listen in a sink thread graph events
* that are produced in another source thread without any explicit
* synchronization on the source of events.
*
*
*
* The only restriction is that the sink thread must regularly call the
* {@link #pump()} method to dispatch events coming from the source to all sinks
* registered (see the explanation in {@link org.graphstream.stream.ProxyPipe}).
*
*
*
* You can register any kind of input as source of event, but if the input is a
* graph, then you can choose to "replay" all the content of the graph so that
* at the other end of the filter, all outputs receive the complete content of
* the graph. This is the default behavior if this filter is constructed with a
* graph as input.
*
*/
public class ThreadProxyPipe extends SourceBase implements ProxyPipe {
/**
* class level logger
*/
private static final Logger logger = Logger.getLogger(ThreadProxyPipe.class.getSimpleName());
/**
* Proxy id.
*/
protected String id;
/**
* The event sender name, usually the graph name.
*/
protected String from;
/**
* The message box used to exchange messages between the two threads.
*/
protected LinkedList events;
protected LinkedList