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.
/*-
* Copyright (C) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
*
* This file was distributed by Oracle as part of a version of Oracle Berkeley
* DB Java Edition made available at:
*
* http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html
*
* Please see the LICENSE file included in the top-level directory of the
* appropriate version of Oracle Berkeley DB Java Edition for a copy of the
* license and additional information.
*/
package com.sleepycat.je.rep.impl.node;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import com.sleepycat.je.rep.ReplicationSecurityException;
import com.sleepycat.je.rep.impl.RepImpl;
import com.sleepycat.je.rep.impl.RepParams;
import com.sleepycat.je.rep.net.DataChannel;
import com.sleepycat.je.rep.stream.Protocol;
import com.sleepycat.je.rep.utilint.RepUtils;
import com.sleepycat.je.utilint.LoggerUtils;
import com.sleepycat.je.utilint.StoppableThread;
import com.sleepycat.je.utilint.TestHook;
import com.sleepycat.je.utilint.TestHookExecute;
/**
* The thread used to write responses asynchronously to the network, to avoid
* network stalls in the replica replay thread. This thread, like the
* Replica.ReplayThread, is created each time the node establishes contact with
* a new feeder and starts replaying the log from it.
*
* The inputs and outputs of this thread are schematically described as:
*
* {@literal
* outputQueue -> ReplicaOutputThread (does write) -> writes to network
* }
*
* It's the third component of the three thread structure outlined in the
* Replica's class level comment.
*/
public abstract class ReplicaOutputThreadBase extends StoppableThread {
/**
* The size of the write queue.
*/
protected final int queueSize;
/*
* The heartbeat interval in ms.
*/
protected final int heartbeatMs;
/**
* Thread exit exception. It's non-null if the thread exited due to an
* exception. It's the responsibility of the main replica thread to
* propagate the exception across the thread boundary in this case.
*/
protected volatile Exception exception;
protected final RepImpl repImpl;
/*
* A reference to the common output queue shared with Replay
*/
protected final BlockingQueue outputQueue;
protected final Protocol protocol ;
protected final DataChannel replicaFeederChannel;
/*
* Reserved transaction ids, that don't represent transaction Acks
* when encountered in the write queue.
*/
/*
* Forces the replica thread to exit when encountered in the write
* queue.
*/
public final static Long EOF = Long.MAX_VALUE;
/**
* One of two txn ID values that results in a heartbeat response when
* encountered in the write queue.
*/
public final static Long HEARTBEAT_ACK = EOF - 1;
/**
* Another txn ID that results in a heartbeat response when encountered in
* the write queue, and is used to mark a heartbeat response whose time
* spent in the queue is being measured.
*/
public final static Long HEARTBEAT_ACK_TIMED = EOF - 2;
/*
* Results in a shutdown response when encountered in the write queue.
*/
public final static Long SHUTDOWN_ACK = EOF - 3;
private TestHook