Path: blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/MessageQueue.java
41161 views
/*1* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324package sun.jvm.hotspot.utilities;2526/** <p> A two-way unbounded-length message queue useful for27communication between threads. Messages written on one side become28readable on the other in first-in, first-out order. This is an29interface to one of two "sides" of an underlying backend, for30example, the MessageQueueBackend. </p> */3132public interface MessageQueue {33/** This blocks until a message is available. Even if the thread is34interrupted while it is waiting, this will not return until a35message is written by the entity on the other side of the36queue. */37public Object readMessage();3839/** This blocks for up to <code>millis</code> milliseconds until a40message is available. If no message becomes available within41this time period, or the thread is interrupted during the wait,42returns null. (This implies that passing the value null back and43forth is not distinguishable with this method.) Passing a value44of 0 for the <code>millis</code> argument causes this method to45return without blocking. The millis argument must be greater46than or equal to zero. */47public Object readMessageWithTimeout(long millis);4849/** Write a message to the queue */50public void writeMessage(Object obj);51}525354