|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2002, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2002, 2012 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 18-29
Link Here
|
| 18 |
* Noriaki Takatsu (IBM) - [257666] [multithread] TCP/IP socket connection is not closed |
18 |
* Noriaki Takatsu (IBM) - [257666] [multithread] TCP/IP socket connection is not closed |
| 19 |
* David McKnight (IBM) - [257666] modified original patch to simplify |
19 |
* David McKnight (IBM) - [257666] modified original patch to simplify |
| 20 |
* Noriaki Takatsu (IBM) - [283656] [dstore][multithread] Serviceability issue |
20 |
* Noriaki Takatsu (IBM) - [283656] [dstore][multithread] Serviceability issue |
|
|
21 |
* David McKnight (IBM) - [385793] [dstore] DataStore spirit mechanism and other memory improvements needed |
| 21 |
*******************************************************************************/ |
22 |
*******************************************************************************/ |
| 22 |
|
23 |
|
| 23 |
package org.eclipse.dstore.core.server; |
24 |
package org.eclipse.dstore.core.server; |
| 24 |
|
25 |
|
| 25 |
import java.io.IOException; |
26 |
import java.io.IOException; |
| 26 |
import java.net.Socket; |
27 |
import java.net.Socket; |
|
|
28 |
import java.util.List; |
| 27 |
|
29 |
|
| 28 |
import org.eclipse.dstore.core.model.DataElement; |
30 |
import org.eclipse.dstore.core.model.DataElement; |
| 29 |
import org.eclipse.dstore.core.util.Receiver; |
31 |
import org.eclipse.dstore.core.util.Receiver; |
|
Lines 37-45
Link Here
|
| 37 |
*/ |
39 |
*/ |
| 38 |
public class ServerReceiver extends Receiver |
40 |
public class ServerReceiver extends Receiver |
| 39 |
{ |
41 |
{ |
| 40 |
|
42 |
private DataElement _log; |
|
|
43 |
private int _maxLog = 20; |
| 44 |
private int _logIndex = 0; |
| 45 |
|
| 41 |
private ConnectionEstablisher _connection; |
46 |
private ConnectionEstablisher _connection; |
| 42 |
|
47 |
|
| 43 |
/** |
48 |
/** |
| 44 |
* Constructor |
49 |
* Constructor |
| 45 |
* |
50 |
* |
|
Lines 66-74
Link Here
|
| 66 |
{ |
71 |
{ |
| 67 |
DataElement rootOutput = documentObject.get(a); |
72 |
DataElement rootOutput = documentObject.get(a); |
| 68 |
|
73 |
|
| 69 |
DataElement log = _dataStore.getLogRoot(); |
74 |
// max log |
| 70 |
log.addNestedData(rootOutput, false); |
75 |
List logged = _log.getNestedData(); |
| 71 |
|
76 |
if (logged == null){ |
|
|
77 |
_log.addNestedData(rootOutput, false); |
| 78 |
_logIndex++; |
| 79 |
} |
| 80 |
else { |
| 81 |
if (_logIndex > _maxLog){ |
| 82 |
_logIndex = 0; // reset logindex |
| 83 |
} |
| 84 |
|
| 85 |
if (logged.size() > _logIndex){ |
| 86 |
logged.set(_logIndex, rootOutput); |
| 87 |
} |
| 88 |
else { |
| 89 |
logged.add(_logIndex, rootOutput); |
| 90 |
} |
| 91 |
_logIndex++; |
| 92 |
} |
| 93 |
|
| 72 |
if (rootOutput.getName().equals("C_EXIT")) //$NON-NLS-1$ |
94 |
if (rootOutput.getName().equals("C_EXIT")) //$NON-NLS-1$ |
| 73 |
{ |
95 |
{ |
| 74 |
finish(); |
96 |
finish(); |