001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2006-2008 Sun Microsystems, Inc. 015 * Portions Copyright 2013-2015 ForgeRock AS. 016 */ 017package org.opends.server.replication.protocol; 018 019import java.util.zip.DataFormatException; 020 021/** 022 * This message is used by LDAP or Replication Server that have been out of 023 * credit for a while and want to check if the remote servers is able to accept 024 * more messages. 025 * <p> 026 * A sending entity that is blocked because its send window is closed for a 027 * while should create such a message to check that the window closure is valid. 028 * <p> 029 * An entity that received such a message should respond with a 030 * {@link WindowMsg} indicating the current credit available. 031 */ 032public class WindowProbeMsg extends ReplicationMsg 033{ 034 /** 035 * Create a new WindowProbeMsg message. 036 */ 037 public WindowProbeMsg() 038 { 039 } 040 041 /** 042 * Creates a new WindowProbeMsg from its encoded form. 043 * 044 * @param in The byte array containing the encoded form of the 045 * WindowMessage. 046 * @throws DataFormatException If the byte array does not contain a valid 047 * encoded form of the WindowMessage. 048 */ 049 public WindowProbeMsg(byte[] in) throws DataFormatException 050 { 051 // WindowProbeMsg only contains its type. 052 if (in[0] != MSG_TYPE_WINDOW_PROBE) 053 { 054 throw new DataFormatException("input is not a valid WindowProbeMsg"); 055 } 056 } 057 058 /** {@inheritDoc} */ 059 @Override 060 public byte[] getBytes(short protocolVersion) 061 { 062 // WindowProbeMsg only contains its type. 063 return new byte[] { MSG_TYPE_WINDOW_PROBE }; 064 } 065}