2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
9 package com.sleepycat.db;
11 import com.sleepycat.db.internal.DbChannel;
14 A ReplicationChannel handle is used to manage a channel in a replication group.
15 ReplicationChannel handles are opened using the {@link com.sleepycat.db.Environment#openChannel Environment.openChannel} method.
17 public class ReplicationChannel {
18 private DbChannel chan;
21 ReplicationChannel(final DbChannel chan) {
29 throws DatabaseException {
35 Send a message on the message channel asynchronously.
39 public void sendMessage(java.util.Set messages)
40 throws DatabaseException {
42 DatabaseEntry[] msgs = (DatabaseEntry[])messages.toArray();
43 this.chan.send_repmsg(msgs, msgs.length, 0);
47 Send request on the message channel. It blocks waiting for a response
54 public void sendRequest(
55 java.util.Set messages, DatabaseEntry response, long timeout)
56 throws DatabaseException {
58 DatabaseEntry[] msgs = (DatabaseEntry[])messages.toArray();
59 this.chan.send_request(msgs, msgs.length, response, timeout, 0);
63 Sets the default timeout value for the channel.
67 public void setTimeout(long timeout)
68 throws DatabaseException {
70 this.chan.set_timeout(timeout);