1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.server.protocol;
14 public abstract class AbstractMessage extends Message {
15 protected final int requestNumber;
16 protected final int responseNumber;
17 protected int receivedNumber = 0;
18 protected boolean responsePending = false;
19 protected DataBuffer buffer;
20 private String exceptionText = null;
21 AbstractMessage(int requestNumber, int responseNumber) {
22 this.requestNumber = requestNumber;
23 this.responseNumber = responseNumber;
24 this.buffer = new DataBuffer(DataBuffer.Allocation.DirectAllocation); //ByteBuffer.allocate(0);
26 AbstractMessage(int requestNumber, int responseNumber, DataBuffer buffer) {
27 this.requestNumber = requestNumber;
28 this.responseNumber = responseNumber;
31 public int getRequestNumber() {
34 public int getResponseNumber() {
35 return responseNumber;
38 boolean hasResponse() {
39 return responseNumber != 0;
42 String getExceptionText() {
43 return this.exceptionText;
46 void setExceptionText(String text) {
47 this.exceptionText = text;
50 responsePending = false;