00001 /** 00002 * (c) B2BITS EPAM Systems Company 2000-2009. 00003 * "Licensor" shall mean B2BITS EPAM Systems Company (B2BITS). 00004 00005 * This software is for the use of the paying client of B2BITS (which may be 00006 * a corporation, business area, business unit or single user) to whom it was 00007 * delivered (the "Licensee"). The use of this software is subject to 00008 * licence terms. 00009 * 00010 * The Licensee acknowledges and agrees that the Software and Documentation 00011 * (the "Confidential Information") is confidential and proprietary to 00012 * the Licensor and the Licensee hereby agrees to use the Confidential 00013 * Information only as permitted by the full licence agreement between 00014 * the two parties, to maintain the confidentiality of the Confidential 00015 * Information and not to disclose the confidential information, or any part 00016 * thereof, to any other person, firm or corporation. The Licensee 00017 * acknowledges that disclosure of the Confidential Information may give rise 00018 * to an irreparable injury to the Licensor in-adequately compensable in 00019 * damages. Accordingly the Licensor may seek (without the posting of any 00020 * bond or other security) injunctive relief against the breach of the forgoing 00021 * undertaking of confidentiality and non-disclosure, in addition to any other 00022 * legal remedies which may be available, and the licensee consents to the 00023 * obtaining of such injunctive relief. All of the undertakings and 00024 * obligations relating to confidentiality and non-disclosure, whether 00025 * contained in this section or elsewhere in this agreement, shall survive 00026 * the termination or expiration of this agreement for a period of five (5) 00027 * years. 00028 * 00029 * The Licensor agrees that any information or data received from the Licensee 00030 * in connection with the performance of the support agreement relating to this 00031 * software shall be confidential, will be used only in connection with the 00032 * performance of the Licensor's obligations hereunder, and will not be 00033 * disclosed to third parties, including contractors, without the Licensor's 00034 * express permission in writing. 00035 * 00036 * Information regarding the software may be provided to the Licensee's outside 00037 * auditors and attorneys only to the extent required by their respective 00038 * functions. 00039 */ 00040 00041 package com.epam.benchmark.latency; 00042 00043 import com.epam.fixengine.transport.InitiatorFIXTransport; 00044 00045 import java.io.IOException; 00046 00047 /** 00048 * Transport for latency BM 00049 * Date: 05.11.2009 00050 * 00051 * @author Oleg_Kornev 00052 */ 00053 public class MeasureLatencyTransport extends InitiatorFIXTransport { 00054 00055 private FIXTransportListener fixTransportListener; 00056 00057 /** 00058 * constructor 00059 * 00060 * @param host - host 00061 * @param port - port 00062 * @param fixTransportListener - transport listener 00063 */ 00064 public MeasureLatencyTransport(String host, int port, FIXTransportListener fixTransportListener) { 00065 super(host, port); 00066 this.fixTransportListener = fixTransportListener; 00067 } 00068 00069 @Override 00070 public void write(byte[] message) throws IOException { 00071 fixTransportListener.onBeforeMessageSend(message); 00072 super.write(message); 00073 } 00074 00075 @Override 00076 public void write(byte[] message, int offset, int length) throws IOException { 00077 fixTransportListener.onBeforeMessageSend(message); 00078 super.write(message, offset, length); 00079 } 00080 00081 @Override 00082 public int getOptimalBufferSize() { 00083 return 1; 00084 } 00085 }