summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-02-05 02:41:51 (EST)
committerEike Stepper2007-02-05 02:41:51 (EST)
commitd5e0069d9600520bc819e8140d26581f38cbbbea (patch)
tree9869cd10d2f8cc44ffb1f19703a0cacbe1a50017
parentb241fcbab8a97227ddf5b773d6889d664644a6c5 (diff)
downloadcdo-d5e0069d9600520bc819e8140d26581f38cbbbea.zip
cdo-d5e0069d9600520bc819e8140d26581f38cbbbea.tar.gz
cdo-d5e0069d9600520bc819e8140d26581f38cbbbea.tar.bz2
Develop CDO2 - http://www.eclipse.org/emft/projects/cdo/#cdo
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1FactoryImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java99
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1Switch.java3
-rw-r--r--plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java7
-rw-r--r--plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/views/RemoteTraceView.java17
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/HugeData.java1267
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java3
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java3
-rw-r--r--plugins/org.eclipse.net4j/.options2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/LegacyBundle.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java9
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocol.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactoryImpl.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferImpl.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPoolImpl.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ChannelImpl.java11
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/AbstractEmbeddedConnector.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ControlChannelImpl.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ServerTCPConnectorImpl.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java7
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPSelectorImpl.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Indication.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IndicationWithResponse.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalReactor.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Channel.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Connector.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactory.java7
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/HexUtil.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/Net4jUtil.java14
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/AbstractLifecycle.java6
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java7
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Singleton.java25
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java3
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java5
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java8
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java3
46 files changed, 367 insertions, 1236 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1FactoryImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1FactoryImpl.java
index 5b7f8dd..60a8934 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1FactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1FactoryImpl.java
@@ -86,8 +86,7 @@ public class Model1FactoryImpl extends EFactoryImpl implements Model1Factory
case Model1Package.COMPANY:
return (EObject)createCompany();
default:
- throw new IllegalArgumentException("The class '" + eClass.getName()
- + "' is not a valid classifier");
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java
index 7812929..d4e68bf 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java
@@ -125,9 +125,9 @@ public class Model1PackageImpl extends EPackageImpl implements Model1Package
return (Model1Package)EPackage.Registry.INSTANCE.getEPackage(Model1Package.eNS_URI);
// Obtain or create and register package
- Model1PackageImpl theModel1Package = (Model1PackageImpl)(EPackage.Registry.INSTANCE
- .getEPackage(eNS_URI) instanceof Model1PackageImpl ? EPackage.Registry.INSTANCE
- .getEPackage(eNS_URI) : new Model1PackageImpl());
+ Model1PackageImpl theModel1Package = (Model1PackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof Model1PackageImpl ? EPackage.Registry.INSTANCE
+ .getEPackage(eNS_URI)
+ : new Model1PackageImpl());
isInited = true;
@@ -418,62 +418,53 @@ public class Model1PackageImpl extends EPackageImpl implements Model1Package
// Add supertypes to classes
// Initialize classes and features; add operations and parameters
- initEClass(supplierEClass, Supplier.class, "Supplier", !IS_ABSTRACT, !IS_INTERFACE,
- IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getSupplier_Name(), ecorePackage.getEString(), "name", null, 0, 1,
- Supplier.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID,
- IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEClass(supplierEClass, Supplier.class, "Supplier", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getSupplier_Name(), ecorePackage.getEString(), "name", null, 0, 1, Supplier.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(purchaseOrderEClass, PurchaseOrder.class, "PurchaseOrder", !IS_ABSTRACT,
- !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPurchaseOrder_Date(), ecorePackage.getEDate(), "date", null, 0, 1,
- PurchaseOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID,
- IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getPurchaseOrder_Supplier(), this.getSupplier(), null, "supplier", null, 0, 1,
- PurchaseOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE,
- IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- initEClass(orderDetailEClass, OrderDetail.class, "OrderDetail", !IS_ABSTRACT, !IS_INTERFACE,
+ initEClass(purchaseOrderEClass, PurchaseOrder.class, "PurchaseOrder", !IS_ABSTRACT, !IS_INTERFACE,
IS_GENERATED_INSTANCE_CLASS);
- initEReference(getOrderDetail_Product(), this.getProduct(), this.getProduct_OrderDetails(),
- "product", null, 0, 1, OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
- !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getOrderDetail_Price(), ecorePackage.getEFloat(), "price", null, 0, 1,
- OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID,
- IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPurchaseOrder_Date(), ecorePackage.getEDate(), "date", null, 0, 1, PurchaseOrder.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getPurchaseOrder_Supplier(), this.getSupplier(), null, "supplier", null, 0, 1, PurchaseOrder.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
- initEClass(productEClass, Product.class, "Product", !IS_ABSTRACT, !IS_INTERFACE,
- IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getProduct_Name(), ecorePackage.getEString(), "name", null, 0, 1, Product.class,
- !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED,
- IS_ORDERED);
- initEReference(getProduct_OrderDetails(), this.getOrderDetail(), this.getOrderDetail_Product(),
- "orderDetails", null, 0, -1, Product.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
- !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- initEClass(categoryEClass, Category.class, "Category", !IS_ABSTRACT, !IS_INTERFACE,
+ initEClass(orderDetailEClass, OrderDetail.class, "OrderDetail", !IS_ABSTRACT, !IS_INTERFACE,
IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getCategory_Name(), ecorePackage.getEString(), "name", null, 0, 1,
- Category.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID,
+ initEReference(getOrderDetail_Product(), this.getProduct(), this.getProduct_OrderDetails(), "product", null, 0, 1,
+ OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getOrderDetail_Price(), ecorePackage.getEFloat(), "price", null, 0, 1, OrderDetail.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(productEClass, Product.class, "Product", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getProduct_Name(), ecorePackage.getEString(), "name", null, 0, 1, Product.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getProduct_OrderDetails(), this.getOrderDetail(), this.getOrderDetail_Product(), "orderDetails",
+ null, 0, -1, Product.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(categoryEClass, Category.class, "Category", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getCategory_Name(), ecorePackage.getEString(), "name", null, 0, 1, Category.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getCategory_Categories(), this.getCategory(), null, "categories", null, 0, -1, Category.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+ initEReference(getCategory_Products(), this.getProduct(), null, "products", null, 0, -1, Category.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+
+ initEClass(companyEClass, Company.class, "Company", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getCompany_Categories(), this.getCategory(), null, "categories", null, 0, -1, Company.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+ initEReference(getCompany_Suppliers(), this.getSupplier(), null, "suppliers", null, 0, -1, Company.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+ initEReference(getCompany_PurchaseOrders(), this.getPurchaseOrder(), null, "purchaseOrders", null, 0, -1,
+ Company.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE,
IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getCategory_Categories(), this.getCategory(), null, "categories", null, 0, -1,
- Category.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE,
- !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getCategory_Products(), this.getProduct(), null, "products", null, 0, -1,
- Category.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE,
- !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- initEClass(companyEClass, Company.class, "Company", !IS_ABSTRACT, !IS_INTERFACE,
- IS_GENERATED_INSTANCE_CLASS);
- initEReference(getCompany_Categories(), this.getCategory(), null, "categories", null, 0, -1,
- Company.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE,
- !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getCompany_Suppliers(), this.getSupplier(), null, "suppliers", null, 0, -1,
- Company.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE,
- !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getCompany_PurchaseOrders(), this.getPurchaseOrder(), null, "purchaseOrders",
- null, 0, -1, Company.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE,
- !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1Switch.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1Switch.java
index 3135348..ae97ef5 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1Switch.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1Switch.java
@@ -85,8 +85,7 @@ public class Model1Switch
else
{
List eSuperTypes = theEClass.getESuperTypes();
- return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch((EClass)eSuperTypes.get(0),
- theEObject);
+ return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch((EClass)eSuperTypes.get(0), theEObject);
}
}
diff --git a/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java b/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java
index 35215c2..818a62a 100644
--- a/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java
+++ b/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/RemoteTraceManager.java
@@ -12,6 +12,7 @@ package org.eclipse.net4j.internal.debug;
import org.eclipse.net4j.internal.debug.views.RemoteTraceView;
import org.eclipse.net4j.util.lifecycle.AbstractLifecycle;
+import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.net4j.util.om.trace.RemoteTraceServer;
import org.eclipse.net4j.util.om.trace.RemoteTraceServer.Event;
import org.eclipse.net4j.util.om.trace.RemoteTraceServer.Listener;
@@ -24,6 +25,7 @@ import java.util.List;
*/
public class RemoteTraceManager extends AbstractLifecycle implements Listener
{
+ @Singleton
public static final RemoteTraceManager INSTANCE = new RemoteTraceManager();
private RemoteTraceServer server;
@@ -47,10 +49,7 @@ public class RemoteTraceManager extends AbstractLifecycle implements Listener
public void notifyRemoteTrace(Event event)
{
events.add(event);
- if (RemoteTraceView.INSTANCE != null)
- {
- RemoteTraceView.INSTANCE.notifyNewTrace();
- }
+ RemoteTraceView.notifyNewTrace();
}
@Override
diff --git a/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/views/RemoteTraceView.java b/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/views/RemoteTraceView.java
index 989479f..91fd4db 100644
--- a/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/views/RemoteTraceView.java
+++ b/plugins/org.eclipse.net4j.debug/src/org/eclipse/net4j/internal/debug/views/RemoteTraceView.java
@@ -48,7 +48,7 @@ import org.eclipse.ui.part.ViewPart;
*/
public class RemoteTraceView extends ViewPart
{
- public static RemoteTraceView INSTANCE;
+ private static RemoteTraceView instance;
private TableViewer viewer;
@@ -63,7 +63,7 @@ public class RemoteTraceView extends ViewPart
@Override
public void dispose()
{
- INSTANCE = null;
+ instance = null;
super.dispose();
}
@@ -85,13 +85,13 @@ public class RemoteTraceView extends ViewPart
hookContextMenu();
hookDoubleClickAction();
contributeToActionBars();
- INSTANCE = this;
+ instance = this;
}
protected void createColmuns(TableViewer viewer)
{
- final String[] columnNames = { "ID", "Time Stamp", "Agent ID", "Bundle ID", "Tracer Name",
- "Context", "Message", "Throwable" };
+ final String[] columnNames = { "ID", "Time Stamp", "Agent ID", "Bundle ID", "Tracer Name", "Context", "Message",
+ "Throwable" };
final int[] columnWidths = { 60, 170, 80, 160, 120, 120, 400, 200 };
TableColumn[] columns = new TableColumn[columnNames.length];
for (int i = 0; i < columns.length; i++)
@@ -104,9 +104,12 @@ public class RemoteTraceView extends ViewPart
}
}
- public void notifyNewTrace()
+ public static void notifyNewTrace()
{
- refreshViewer();
+ if (instance != null)
+ {
+ instance.refreshViewer();
+ }
}
public void refreshViewer()
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/HugeData.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/HugeData.java
index 60cd5d1..eb4e5aa 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/HugeData.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/HugeData.java
@@ -36,1071 +36,210 @@ public final class HugeData
public static String getText()
{
- return "/***************************************************************************"
- + NL
- + " * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany."
- + NL
- + " * All rights reserved. This program and the accompanying materials"
- + NL
- + " * are made available under the terms of the Eclipse Public License v1.0"
- + NL
- + " * which accompanies this distribution, and is available at"
- + NL
- + " * http://www.eclipse.org/legal/epl-v10.html"
- + NL
- + " * "
- + NL
- + " * Contributors:"
- + NL
- + " * Eike Stepper - initial API and implementation"
- + NL
- + " **************************************************************************/"
- + NL
- + "package org.eclipse.internal.net4j.transport.connector;"
- + NL
- + ""
- + NL
- + "import org.eclipse.net4j.transport.buffer.BufferProvider;"
- + NL
- + "import org.eclipse.net4j.transport.channel.Channel;"
- + NL
- + "import org.eclipse.net4j.transport.channel.Multiplexer;"
- + NL
- + "import org.eclipse.net4j.transport.connector.Connector;"
- + NL
- + "import org.eclipse.net4j.transport.connector.ConnectorException;"
- + NL
- + "import org.eclipse.net4j.transport.connector.Credentials;"
- + NL
- + "import org.eclipse.net4j.transport.connector.Protocol;"
- + NL
- + "import org.eclipse.net4j.transport.connector.ProtocolFactory;"
- + NL
- + "import org.eclipse.net4j.util.lifecycle.LifecycleListener;"
- + NL
- + "import org.eclipse.net4j.util.lifecycle.LifecycleNotifier;"
- + NL
- + "import org.eclipse.net4j.util.registry.IRegistry;"
- + NL
- + ""
- + NL
- + "import org.eclipse.internal.net4j.transport.channel.ChannelImpl;"
- + NL
- + "import org.eclipse.internal.net4j.util.stream.BufferQueue;"
- + NL
- + "import org.eclipse.internal.net4j.util.lifecycle.AbstractComponent;"
- + NL
- + "import org.eclipse.internal.net4j.util.lifecycle.LifecycleUtil;"
- + NL
- + ""
- + NL
- + "import java.util.ArrayList;"
- + NL
- + "import java.util.List;"
- + NL
- + "import java.util.Queue;"
- + NL
- + "import java.util.concurrent.ConcurrentLinkedQueue;"
- + NL
- + "import java.util.concurrent.CountDownLatch;"
- + NL
- + "import java.util.concurrent.ExecutorService;"
- + NL
- + "import java.util.concurrent.TimeUnit;"
- + NL
- + ""
- + NL
- + "/**"
- + NL
- + " * @author Eike Stepper"
- + NL
- + " */"
- + NL
+ return "/***************************************************************************" + NL
+ + " * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany." + NL
+ + " * All rights reserved. This program and the accompanying materials" + NL
+ + " * are made available under the terms of the Eclipse Public License v1.0" + NL
+ + " * which accompanies this distribution, and is available at" + NL
+ + " * http://www.eclipse.org/legal/epl-v10.html" + NL + " * " + NL + " * Contributors:" + NL
+ + " * Eike Stepper - initial API and implementation" + NL
+ + " **************************************************************************/" + NL
+ + "package org.eclipse.internal.net4j.transport.connector;" + NL + "" + NL
+ + "import org.eclipse.net4j.transport.buffer.BufferProvider;" + NL
+ + "import org.eclipse.net4j.transport.channel.Channel;" + NL
+ + "import org.eclipse.net4j.transport.channel.Multiplexer;" + NL
+ + "import org.eclipse.net4j.transport.connector.Connector;" + NL
+ + "import org.eclipse.net4j.transport.connector.ConnectorException;" + NL
+ + "import org.eclipse.net4j.transport.connector.Credentials;" + NL
+ + "import org.eclipse.net4j.transport.connector.Protocol;" + NL
+ + "import org.eclipse.net4j.transport.connector.ProtocolFactory;" + NL
+ + "import org.eclipse.net4j.util.lifecycle.LifecycleListener;" + NL
+ + "import org.eclipse.net4j.util.lifecycle.LifecycleNotifier;" + NL
+ + "import org.eclipse.net4j.util.registry.IRegistry;" + NL + "" + NL
+ + "import org.eclipse.internal.net4j.transport.channel.ChannelImpl;" + NL
+ + "import org.eclipse.internal.net4j.util.stream.BufferQueue;" + NL
+ + "import org.eclipse.internal.net4j.util.lifecycle.AbstractComponent;" + NL
+ + "import org.eclipse.internal.net4j.util.lifecycle.LifecycleUtil;" + NL + "" + NL
+ + "import java.util.ArrayList;" + NL + "import java.util.List;" + NL + "import java.util.Queue;" + NL
+ + "import java.util.concurrent.ConcurrentLinkedQueue;" + NL + "import java.util.concurrent.CountDownLatch;"
+ + NL + "import java.util.concurrent.ExecutorService;" + NL + "import java.util.concurrent.TimeUnit;" + NL + ""
+ + NL + "/**" + NL + " * @author Eike Stepper" + NL + " */" + NL
+ "public abstract class AbstractConnector extends AbstractLifecycle implements Connector, ChannelMultiplexer"
- + NL
- + "{"
- + NL
- + " private static final ChannelImpl NULL_CHANNEL = new ChannelImpl(null);"
- + NL
- + ""
- + NL
- + " private ConnectorCredentials credentials;"
- + NL
- + ""
- + NL
- + " private IRegistry<String, ProtocolFactory> protocolFactoryRegistry;"
- + NL
- + ""
- + NL
- + " private BufferProvider bufferProvider;"
- + NL
- + ""
- + NL
- + " /**"
- + NL
- + " * An optional executor to be used by the {@link Channel}s to process their"
- + NL
- + " * {@link ChannelImpl#receiveQueue} instead of the current thread. If not"
- + NL
- + " * <code>null</code> the sender and the receiver peers become decoupled."
- + NL
- + " * <p>"
- + NL
- + " */"
- + NL
- + " private ExecutorService receiveExecutor;"
- + NL
- + ""
- + NL
- + " /**"
- + NL
- + " * TODO synchronize on channels?"
- + NL
- + " */"
- + NL
- + " private List<ChannelImpl> channels = new ArrayList();"
- + NL
- + ""
- + NL
- + " private State state = State.DISCONNECTED;"
- + NL
- + ""
- + NL
- + " /**"
- + NL
- + " * Don\'t initialize lazily to circumvent synchronization!"
- + NL
- + " */"
- + NL
- + " private Queue<StateListener> stateListeners = new ConcurrentLinkedQueue();"
- + NL
- + ""
- + NL
- + " /**"
- + NL
- + " * Don\'t initialize lazily to circumvent synchronization!"
- + NL
- + " */"
- + NL
- + " private Queue<ChannelListener> channelListeners = new ConcurrentLinkedQueue();"
- + NL
- + ""
- + NL
- + " /**"
- + NL
- + " * Is registered with each {@link Channel} of this {@link Connector}."
- + NL
- + " * <p>"
- + NL
- + " */"
- + NL
- + " private LifecycleListener channelLifecycleListener = new ChannelLifecycleListener();"
- + NL
- + ""
- + NL
- + " private CountDownLatch finishedConnecting;"
- + NL
- + ""
- + NL
- + " private CountDownLatch finishedNegotiating;"
- + NL
- + ""
- + NL
- + " public AbstractConnector()"
- + NL
- + " {"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public ExecutorService getReceiveExecutor()"
- + NL
- + " {"
- + NL
- + " return receiveExecutor;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void setReceiveExecutor(ExecutorService receiveExecutor)"
- + NL
- + " {"
- + NL
- + " this.receiveExecutor = receiveExecutor;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public IRegistry<String, ProtocolFactory> getProtocolFactoryRegistry()"
- + NL
- + " {"
- + NL
- + " return protocolFactoryRegistry;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void setProtocolFactoryRegistry(IRegistry<String, ProtocolFactory> protocolFactoryRegistry)"
- + NL
- + " {"
- + NL
- + " this.protocolFactoryRegistry = protocolFactoryRegistry;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void addStateListener(StateListener listener)"
- + NL
- + " {"
- + NL
- + " stateListeners.add(listener);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void removeStateListener(StateListener listener)"
- + NL
- + " {"
- + NL
- + " stateListeners.remove(listener);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void addChannelListener(ChannelListener listener)"
- + NL
- + " {"
- + NL
- + " channelListeners.add(listener);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void removeChannelListener(ChannelListener listener)"
- + NL
- + " {"
- + NL
- + " channelListeners.remove(listener);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public BufferProvider getBufferProvider()"
- + NL
- + " {"
- + NL
- + " return bufferProvider;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void setBufferProvider(BufferProvider bufferProvider)"
- + NL
- + " {"
- + NL
- + " this.bufferProvider = bufferProvider;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public boolean isClient()"
- + NL
- + " {"
- + NL
- + " return getType() == Type.CLIENT;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public boolean isServer()"
- + NL
- + " {"
- + NL
- + " return getType() == Type.SERVER;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public ConnectorCredentials getCredentials()"
- + NL
- + " {"
- + NL
- + " return credentials;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void setCredentials(ConnectorCredentials credentials)"
- + NL
- + " {"
- + NL
- + " this.credentials = credentials;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public State getState()"
- + NL
- + " {"
- + NL
- + " return state;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void setState(State newState) throws ConnectorException"
- + NL
- + " {"
- + NL
- + " State oldState = getState();"
- + NL
- + " if (newState != oldState)"
- + NL
- + " {"
- + NL
- + " System.out.println(toString() + \": Setting state \" + newState + \" (was \""
- + NL
- + " + oldState.toString().toLowerCase() + \")\");"
- + NL
- + " state = newState;"
- + NL
- + " fireStateChanged(newState, oldState);"
- + NL
- + ""
- + NL
- + " switch (newState)"
- + NL
- + " {"
- + NL
- + " case DISCONNECTED:"
- + NL
- + " if (finishedConnecting != null)"
- + NL
- + " {"
- + NL
- + " finishedConnecting.countDown();"
- + NL
- + " finishedConnecting = null;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " if (finishedNegotiating != null)"
- + NL
- + " {"
- + NL
- + " finishedNegotiating.countDown();"
- + NL
- + " finishedNegotiating = null;"
- + NL
- + " }"
- + NL
- + " break;"
- + NL
- + ""
- + NL
- + " case CONNECTING:"
- + NL
- + " finishedConnecting = new CountDownLatch(1);"
- + NL
- + " finishedNegotiating = new CountDownLatch(1);"
- + NL
- + " if (getType() == Type.SERVER)"
- + NL
- + " {"
- + NL
- + " setState(State.NEGOTIATING);"
- + NL
- + " }"
- + NL
- + " break;"
- + NL
- + ""
- + NL
- + " case NEGOTIATING:"
- + NL
- + " finishedConnecting.countDown();"
- + NL
- + " setState(State.CONNECTED); // TODO Implement negotiation"
- + NL
- + " break;"
- + NL
- + ""
- + NL
- + " case CONNECTED:"
- + NL
- + " finishedConnecting.countDown(); // Just in case of suspicion"
- + NL
- + " finishedNegotiating.countDown();"
- + NL
- + " break;"
- + NL
- + ""
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public boolean isConnected()"
- + NL
- + " {"
- + NL
- + " return getState() == State.CONNECTED;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public void connectAsync() throws ConnectorException"
- + NL
- + " {"
- + NL
- + " try"
- + NL
- + " {"
- + NL
- + " activate();"
- + NL
- + " }"
- + NL
- + " catch (ConnectorException ex)"
- + NL
- + " {"
- + NL
- + " throw ex;"
- + NL
- + " }"
- + NL
- + " catch (Exception ex)"
- + NL
- + " {"
- + NL
- + " throw new ConnectorException(ex);"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public boolean waitForConnection(long timeout) throws ConnectorException"
- + NL
- + " {"
- + NL
- + " State state = getState();"
- + NL
- + " if (state == State.DISCONNECTED)"
- + NL
- + " {"
- + NL
- + " return false;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " try"
- + NL
- + " {"
- + NL
- + " System.out.println(toString() + \": Waiting for connection...\");"
- + NL
- + " return finishedNegotiating.await(timeout, TimeUnit.MILLISECONDS);"
- + NL
- + " }"
- + NL
- + " catch (InterruptedException ex)"
- + NL
- + " {"
- + NL
- + " return false;"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public boolean connect(long timeout) throws ConnectorException"
- + NL
- + " {"
- + NL
- + " connectAsync();"
- + NL
- + " return waitForConnection(timeout);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public ConnectorException disconnect()"
- + NL
- + " {"
- + NL
- + " Exception ex = deactivate();"
- + NL
- + " if (ex == null)"
- + NL
- + " {"
- + NL
- + " return null;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " if (ex instanceof ConnectorException)"
- + NL
- + " {"
- + NL
- + " return (ConnectorException)ex;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " return new ConnectorException(ex);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public Channel[] getChannels()"
- + NL
- + " {"
- + NL
- + " final List<Channel> result = new ArrayList<Channel>();"
- + NL
- + " synchronized (channels)"
- + NL
- + " {"
- + NL
- + " for (final ChannelImpl channel : channels)"
- + NL
- + " {"
- + NL
- + " if (channel != NULL_CHANNEL)"
- + NL
- + " {"
- + NL
- + " result.add(channel);"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " return result.toArray(new Channel[result.size()]);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public Channel openChannel() throws ConnectorException"
- + NL
- + " {"
- + NL
- + " return openChannel(null);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public Channel openChannel(String protocolID) throws ConnectorException"
- + NL
- + " {"
- + NL
- + " short channelIndex = findFreeChannelIndex();"
- + NL
- + " ChannelImpl channel = createChannel(channelIndex, protocolID);"
- + NL
- + " registerChannelWithPeer(channelIndex, protocolID);"
- + NL
- + ""
- + NL
- + " try"
- + NL
- + " {"
- + NL
- + " channel.activate();"
- + NL
- + " }"
- + NL
- + " catch (ConnectorException ex)"
- + NL
- + " {"
- + NL
- + " throw ex;"
- + NL
- + " }"
- + NL
- + " catch (Exception ex)"
- + NL
- + " {"
- + NL
- + " throw new ConnectorException(ex);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " return channel;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public ChannelImpl createChannel(short channelIndex, String protocolID)"
- + NL
- + " {"
- + NL
- + " Protocol protocol = createProtocol(protocolID);"
- + NL
- + " if (protocol == null)"
- + NL
- + " {"
- + NL
- + " System.out.println(toString() + \": Opening channel without protocol\");"
- + NL
- + " }"
- + NL
- + " else"
- + NL
- + " {"
- + NL
- + " System.out.println(toString() + \": Opening channel with protocol \" + protocolID);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " ChannelImpl channel = new ChannelImpl(receiveExecutor);"
- + NL
- + " channel.setChannelIndex(channelIndex);"
- + NL
- + " channel.setMultiplexer(this);"
- + NL
- + " channel.setReceiveHandler(protocol);"
- + NL
- + " channel.addLifecycleListener(channelLifecycleListener);"
- + NL
- + " addChannel(channel);"
- + NL
- + " return channel;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " public ChannelImpl getChannel(short channelIndex)"
- + NL
- + " {"
- + NL
- + " try"
- + NL
- + " {"
- + NL
- + " ChannelImpl channel = channels.get(channelIndex);"
- + NL
- + " if (channel == null || channel == NULL_CHANNEL)"
- + NL
- + " {"
- + NL
- + " throw new NullPointerException();"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " return channel;"
- + NL
- + " }"
- + NL
- + " catch (IndexOutOfBoundsException ex)"
- + NL
- + " {"
- + NL
- + " System.out.println(toString() + \": Invalid channelIndex \" + channelIndex);"
- + NL
- + " return null;"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " protected List<BufferQueue> getChannelBufferQueues()"
- + NL
- + " {"
- + NL
- + " final List<BufferQueue> result = new ArrayList<BufferQueue>();"
- + NL
- + " synchronized (channels)"
- + NL
- + " {"
- + NL
- + " for (final ChannelImpl channel : channels)"
- + NL
- + " {"
- + NL
- + " if (channel != NULL_CHANNEL)"
- + NL
- + " {"
- + NL
- + " BufferQueue bufferQueue = channel.getSendQueue();"
- + NL
- + " result.add(bufferQueue);"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " return result;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " protected short findFreeChannelIndex()"
- + NL
- + " {"
- + NL
- + " synchronized (channels)"
- + NL
- + " {"
- + NL
- + " int size = channels.size();"
- + NL
- + " for (short i = 0; i < size; i++)"
- + NL
- + " {"
- + NL
- + " if (channels.get(i) == NULL_CHANNEL)"
- + NL
- + " {"
- + NL
- + " return i;"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " channels.add(NULL_CHANNEL);"
- + NL
- + " return (short)size;"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " protected void addChannel(ChannelImpl channel)"
- + NL
- + " {"
- + NL
- + " short channelIndex = channel.getChannelIndex();"
- + NL
- + " while (channelIndex >= channels.size())"
- + NL
- + " {"
- + NL
- + " channels.add(NULL_CHANNEL);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " channels.set(channelIndex, channel);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " protected void removeChannel(ChannelImpl channel)"
- + NL
- + " {"
- + NL
- + " channel.removeLifecycleListener(channelLifecycleListener);"
- + NL
- + " int channelIndex = channel.getChannelIndex();"
- + NL
- + ""
- + NL
- + " System.out.println(toString() + \": Removing channel \" + channelIndex);"
- + NL
- + " channels.set(channelIndex, NULL_CHANNEL);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " protected Protocol createProtocol(String protocolID)"
- + NL
- + " {"
- + NL
- + " if (protocolID == null || protocolID.length() == 0)"
- + NL
- + " {"
- + NL
- + " return null;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " IRegistry<String, ProtocolFactory> registry = getProtocolFactoryRegistry();"
- + NL
- + " if (registry == null)"
- + NL
- + " {"
- + NL
- + " return null;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " ProtocolFactory factory = registry.lookup(protocolID);"
- + NL
- + " if (factory == null)"
- + NL
- + " {"
- + NL
- + " return null;"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " System.out.println(toString() + \": Creating protocol \" + protocolID);"
- + NL
- + " return factory.createProtocol();"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " protected void fireChannelOpened(Channel channel)"
- + NL
- + " {"
- + NL
- + " for (ChannelListener listener : channelListeners)"
- + NL
- + " {"
- + NL
- + " try"
- + NL
- + " {"
- + NL
- + " listener.notifyChannelOpened(channel);"
- + NL
- + " }"
- + NL
- + " catch (Exception ex)"
- + NL
- + " {"
- + NL
- + " ex.printStackTrace();"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " protected void fireChannelClosing(Channel channel)"
- + NL
- + " {"
- + NL
- + " for (ChannelListener listener : channelListeners)"
- + NL
- + " {"
- + NL
- + " try"
- + NL
- + " {"
- + NL
- + " listener.notifyChannelClosing(channel);"
- + NL
- + " }"
- + NL
- + " catch (Exception ex)"
- + NL
- + " {"
- + NL
- + " ex.printStackTrace();"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " protected void fireStateChanged(State newState, State oldState)"
- + NL
- + " {"
- + NL
- + " for (StateListener listener : stateListeners)"
- + NL
- + " {"
- + NL
- + " try"
- + NL
- + " {"
- + NL
- + " listener.notifyStateChanged(this, newState, oldState);"
- + NL
- + " }"
- + NL
- + " catch (Exception ex)"
- + NL
- + " {"
- + NL
- + " ex.printStackTrace();"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " @Override"
- + NL
- + " protected void onAccessBeforeActivate() throws Exception"
- + NL
- + " {"
- + NL
- + " super.onAccessBeforeActivate();"
- + NL
- + " if (bufferProvider == null)"
- + NL
- + " {"
- + NL
- + " throw new IllegalStateException(\"bufferProvider == null\");"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " if (protocolFactoryRegistry == null)"
- + NL
- + " {"
- + NL
- + " System.out.println(toString() + \": (INFO) protocolFactoryRegistry == null\");"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " if (receiveExecutor == null)"
- + NL
- + " {"
- + NL
- + " System.out.println(toString() + \": (INFO) receiveExecutor == null\");"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " @Override"
- + NL
- + " protected void onActivate() throws Exception"
- + NL
- + " {"
- + NL
- + " super.onActivate();"
- + NL
- + " setState(State.CONNECTING);"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " @Override"
- + NL
- + " protected void onDeactivate() throws Exception"
- + NL
- + " {"
- + NL
- + " setState(State.DISCONNECTED);"
- + NL
- + " for (short i = 0; i < channels.size(); i++)"
- + NL
- + " {"
- + NL
- + " ChannelImpl channel = channels.get(i);"
- + NL
- + " if (channel != null)"
- + NL
- + " {"
- + NL
- + " LifecycleUtil.deactivate(channel);"
- + NL
- + " }"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " channels.clear();"
- + NL
- + " super.onDeactivate();"
- + NL
- + " }"
- + NL
- + ""
- + NL
- + " protected abstract void registerChannelWithPeer(short channelIndex, String protocolID)"
- + NL + " throws ConnectorException;" + NL + "" + NL + " /**" + NL
- + " * Is registered with each {@link Channel} of this {@link Connector}." + NL
- + " * <p>" + NL + " * " + NL + " * @author Eike Stepper" + NL + " */" + NL
- + " private final class ChannelLifecycleListener implements LifecycleListener" + NL
- + " {" + NL + " public void notifyLifecycleActivated(LifecycleNotifier notifier)" + NL
+ + NL + "{" + NL + " private static final ChannelImpl NULL_CHANNEL = new ChannelImpl(null);" + NL + "" + NL
+ + " private ConnectorCredentials credentials;" + NL + "" + NL
+ + " private IRegistry<String, ProtocolFactory> protocolFactoryRegistry;" + NL + "" + NL
+ + " private BufferProvider bufferProvider;" + NL + "" + NL + " /**" + NL
+ + " * An optional executor to be used by the {@link Channel}s to process their" + NL
+ + " * {@link ChannelImpl#receiveQueue} instead of the current thread. If not" + NL
+ + " * <code>null</code> the sender and the receiver peers become decoupled." + NL + " * <p>" + NL + " */"
+ + NL + " private ExecutorService receiveExecutor;" + NL + "" + NL + " /**" + NL
+ + " * TODO synchronize on channels?" + NL + " */" + NL
+ + " private List<ChannelImpl> channels = new ArrayList();" + NL + "" + NL
+ + " private State state = State.DISCONNECTED;" + NL + "" + NL + " /**" + NL
+ + " * Don\'t initialize lazily to circumvent synchronization!" + NL + " */" + NL
+ + " private Queue<StateListener> stateListeners = new ConcurrentLinkedQueue();" + NL + "" + NL + " /**" + NL
+ + " * Don\'t initialize lazily to circumvent synchronization!" + NL + " */" + NL
+ + " private Queue<ChannelListener> channelListeners = new ConcurrentLinkedQueue();" + NL + "" + NL + " /**"
+ + NL + " * Is registered with each {@link Channel} of this {@link Connector}." + NL + " * <p>" + NL
+ + " */" + NL + " private LifecycleListener channelLifecycleListener = new ChannelLifecycleListener();" + NL
+ + "" + NL + " private CountDownLatch finishedConnecting;" + NL + "" + NL
+ + " private CountDownLatch finishedNegotiating;" + NL + "" + NL + " public AbstractConnector()" + NL + " {"
+ + NL + " }" + NL + "" + NL + " public ExecutorService getReceiveExecutor()" + NL + " {" + NL
+ + " return receiveExecutor;" + NL + " }" + NL + "" + NL
+ + " public void setReceiveExecutor(ExecutorService receiveExecutor)" + NL + " {" + NL
+ + " this.receiveExecutor = receiveExecutor;" + NL + " }" + NL + "" + NL
+ + " public IRegistry<String, ProtocolFactory> getProtocolFactoryRegistry()" + NL + " {" + NL
+ + " return protocolFactoryRegistry;" + NL + " }" + NL + "" + NL
+ + " public void setProtocolFactoryRegistry(IRegistry<String, ProtocolFactory> protocolFactoryRegistry)" + NL
+ + " {" + NL + " this.protocolFactoryRegistry = protocolFactoryRegistry;" + NL + " }" + NL + "" + NL
+ + " public void addStateListener(StateListener listener)" + NL + " {" + NL
+ + " stateListeners.add(listener);" + NL + " }" + NL + "" + NL
+ + " public void removeStateListener(StateListener listener)" + NL + " {" + NL
+ + " stateListeners.remove(listener);" + NL + " }" + NL + "" + NL
+ + " public void addChannelListener(ChannelListener listener)" + NL + " {" + NL
+ + " channelListeners.add(listener);" + NL + " }" + NL + "" + NL
+ + " public void removeChannelListener(ChannelListener listener)" + NL + " {" + NL
+ + " channelListeners.remove(listener);" + NL + " }" + NL + "" + NL
+ + " public BufferProvider getBufferProvider()" + NL + " {" + NL + " return bufferProvider;" + NL + " }"
+ + NL + "" + NL + " public void setBufferProvider(BufferProvider bufferProvider)" + NL + " {" + NL
+ + " this.bufferProvider = bufferProvider;" + NL + " }" + NL + "" + NL + " public boolean isClient()" + NL
+ + " {" + NL + " return getType() == Type.CLIENT;" + NL + " }" + NL + "" + NL
+ + " public boolean isServer()" + NL + " {" + NL + " return getType() == Type.SERVER;" + NL + " }" + NL
+ + "" + NL + " public ConnectorCredentials getCredentials()" + NL + " {" + NL + " return credentials;" + NL
+ + " }" + NL + "" + NL + " public void setCredentials(ConnectorCredentials credentials)" + NL + " {" + NL
+ + " this.credentials = credentials;" + NL + " }" + NL + "" + NL + " public State getState()" + NL + " {"
+ + NL + " return state;" + NL + " }" + NL + "" + NL
+ + " public void setState(State newState) throws ConnectorException" + NL + " {" + NL
+ + " State oldState = getState();" + NL + " if (newState != oldState)" + NL + " {" + NL
+ + " System.out.println(toString() + \": Setting state \" + newState + \" (was \"" + NL
+ + " + oldState.toString().toLowerCase() + \")\");" + NL + " state = newState;" + NL
+ + " fireStateChanged(newState, oldState);" + NL + "" + NL + " switch (newState)" + NL + " {"
+ + NL + " case DISCONNECTED:" + NL + " if (finishedConnecting != null)" + NL + " {" + NL
+ + " finishedConnecting.countDown();" + NL + " finishedConnecting = null;" + NL + " }"
+ + NL + "" + NL + " if (finishedNegotiating != null)" + NL + " {" + NL
+ + " finishedNegotiating.countDown();" + NL + " finishedNegotiating = null;" + NL
+ + " }" + NL + " break;" + NL + "" + NL + " case CONNECTING:" + NL
+ + " finishedConnecting = new CountDownLatch(1);" + NL
+ + " finishedNegotiating = new CountDownLatch(1);" + NL + " if (getType() == Type.SERVER)" + NL
+ + " {" + NL + " setState(State.NEGOTIATING);" + NL + " }" + NL + " break;" + NL
+ + "" + NL + " case NEGOTIATING:" + NL + " finishedConnecting.countDown();" + NL
+ + " setState(State.CONNECTED); // TODO Implement negotiation" + NL + " break;" + NL + "" + NL
+ + " case CONNECTED:" + NL + " finishedConnecting.countDown(); // Just in case of suspicion" + NL
+ + " finishedNegotiating.countDown();" + NL + " break;" + NL + "" + NL + " }" + NL + " }"
+ + NL + " }" + NL + "" + NL + " public boolean isConnected()" + NL + " {" + NL
+ + " return getState() == State.CONNECTED;" + NL + " }" + NL + "" + NL
+ + " public void connectAsync() throws ConnectorException" + NL + " {" + NL + " try" + NL + " {" + NL
+ + " activate();" + NL + " }" + NL + " catch (ConnectorException ex)" + NL + " {" + NL
+ + " throw ex;" + NL + " }" + NL + " catch (Exception ex)" + NL + " {" + NL
+ + " throw new ConnectorException(ex);" + NL + " }" + NL + " }" + NL + "" + NL
+ + " public boolean waitForConnection(long timeout) throws ConnectorException" + NL + " {" + NL
+ + " State state = getState();" + NL + " if (state == State.DISCONNECTED)" + NL + " {" + NL
+ + " return false;" + NL + " }" + NL + "" + NL + " try" + NL + " {" + NL
+ + " System.out.println(toString() + \": Waiting for connection...\");" + NL
+ + " return finishedNegotiating.await(timeout, TimeUnit.MILLISECONDS);" + NL + " }" + NL
+ + " catch (InterruptedException ex)" + NL + " {" + NL + " return false;" + NL + " }" + NL + " }"
+ + NL + "" + NL + " public boolean connect(long timeout) throws ConnectorException" + NL + " {" + NL
+ + " connectAsync();" + NL + " return waitForConnection(timeout);" + NL + " }" + NL + "" + NL
+ + " public ConnectorException disconnect()" + NL + " {" + NL + " Exception ex = deactivate();" + NL
+ + " if (ex == null)" + NL + " {" + NL + " return null;" + NL + " }" + NL + "" + NL
+ + " if (ex instanceof ConnectorException)" + NL + " {" + NL + " return (ConnectorException)ex;" + NL
+ + " }" + NL + "" + NL + " return new ConnectorException(ex);" + NL + " }" + NL + "" + NL
+ + " public Channel[] getChannels()" + NL + " {" + NL
+ + " final List<Channel> result = new ArrayList<Channel>();" + NL + " synchronized (channels)" + NL
+ + " {" + NL + " for (final ChannelImpl channel : channels)" + NL + " {" + NL
+ + " if (channel != NULL_CHANNEL)" + NL + " {" + NL + " result.add(channel);" + NL
+ + " }" + NL + " }" + NL + " }" + NL + "" + NL
+ + " return result.toArray(new Channel[result.size()]);" + NL + " }" + NL + "" + NL
+ + " public Channel openChannel() throws ConnectorException" + NL + " {" + NL
+ + " return openChannel(null);" + NL + " }" + NL + "" + NL
+ + " public Channel openChannel(String protocolID) throws ConnectorException" + NL + " {" + NL
+ + " short channelIndex = findFreeChannelIndex();" + NL
+ + " ChannelImpl channel = createChannel(channelIndex, protocolID);" + NL
+ + " registerChannelWithPeer(channelIndex, protocolID);" + NL + "" + NL + " try" + NL + " {" + NL
+ + " channel.activate();" + NL + " }" + NL + " catch (ConnectorException ex)" + NL + " {" + NL
+ + " throw ex;" + NL + " }" + NL + " catch (Exception ex)" + NL + " {" + NL
+ + " throw new ConnectorException(ex);" + NL + " }" + NL + "" + NL + " return channel;" + NL + " }"
+ + NL + "" + NL + " public ChannelImpl createChannel(short channelIndex, String protocolID)" + NL + " {" + NL
+ + " Protocol protocol = createProtocol(protocolID);" + NL + " if (protocol == null)" + NL + " {" + NL
+ + " System.out.println(toString() + \": Opening channel without protocol\");" + NL + " }" + NL
+ + " else" + NL + " {" + NL
+ + " System.out.println(toString() + \": Opening channel with protocol \" + protocolID);" + NL + " }"
+ + NL + "" + NL + " ChannelImpl channel = new ChannelImpl(receiveExecutor);" + NL
+ + " channel.setChannelIndex(channelIndex);" + NL + " channel.setMultiplexer(this);" + NL
+ + " channel.setReceiveHandler(protocol);" + NL
+ + " channel.addLifecycleListener(channelLifecycleListener);" + NL + " addChannel(channel);" + NL
+ + " return channel;" + NL + " }" + NL + "" + NL + " public ChannelImpl getChannel(short channelIndex)"
+ + NL + " {" + NL + " try" + NL + " {" + NL + " ChannelImpl channel = channels.get(channelIndex);"
+ + NL + " if (channel == null || channel == NULL_CHANNEL)" + NL + " {" + NL
+ + " throw new NullPointerException();" + NL + " }" + NL + "" + NL + " return channel;" + NL
+ + " }" + NL + " catch (IndexOutOfBoundsException ex)" + NL + " {" + NL
+ + " System.out.println(toString() + \": Invalid channelIndex \" + channelIndex);" + NL
+ + " return null;" + NL + " }" + NL + " }" + NL + "" + NL
+ + " protected List<BufferQueue> getChannelBufferQueues()" + NL + " {" + NL
+ + " final List<BufferQueue> result = new ArrayList<BufferQueue>();" + NL + " synchronized (channels)"
+ + NL + " {" + NL + " for (final ChannelImpl channel : channels)" + NL + " {" + NL
+ + " if (channel != NULL_CHANNEL)" + NL + " {" + NL
+ + " BufferQueue bufferQueue = channel.getSendQueue();" + NL + " result.add(bufferQueue);"
+ + NL + " }" + NL + " }" + NL + " }" + NL + "" + NL + " return result;" + NL + " }" + NL + ""
+ + NL + " protected short findFreeChannelIndex()" + NL + " {" + NL + " synchronized (channels)" + NL
+ + " {" + NL + " int size = channels.size();" + NL + " for (short i = 0; i < size; i++)" + NL
+ + " {" + NL + " if (channels.get(i) == NULL_CHANNEL)" + NL + " {" + NL
+ + " return i;" + NL + " }" + NL + " }" + NL + "" + NL
+ + " channels.add(NULL_CHANNEL);" + NL + " return (short)size;" + NL + " }" + NL + " }" + NL + ""
+ + NL + " protected void addChannel(ChannelImpl channel)" + NL + " {" + NL
+ + " short channelIndex = channel.getChannelIndex();" + NL + " while (channelIndex >= channels.size())"
+ + NL + " {" + NL + " channels.add(NULL_CHANNEL);" + NL + " }" + NL + "" + NL
+ + " channels.set(channelIndex, channel);" + NL + " }" + NL + "" + NL
+ + " protected void removeChannel(ChannelImpl channel)" + NL + " {" + NL
+ + " channel.removeLifecycleListener(channelLifecycleListener);" + NL
+ + " int channelIndex = channel.getChannelIndex();" + NL + "" + NL
+ + " System.out.println(toString() + \": Removing channel \" + channelIndex);" + NL
+ + " channels.set(channelIndex, NULL_CHANNEL);" + NL + " }" + NL + "" + NL
+ + " protected Protocol createProtocol(String protocolID)" + NL + " {" + NL
+ + " if (protocolID == null || protocolID.length() == 0)" + NL + " {" + NL + " return null;" + NL
+ + " }" + NL + "" + NL + " IRegistry<String, ProtocolFactory> registry = getProtocolFactoryRegistry();"
+ + NL + " if (registry == null)" + NL + " {" + NL + " return null;" + NL + " }" + NL + "" + NL
+ + " ProtocolFactory factory = registry.lookup(protocolID);" + NL + " if (factory == null)" + NL + " {"
+ + NL + " return null;" + NL + " }" + NL + "" + NL
+ + " System.out.println(toString() + \": Creating protocol \" + protocolID);" + NL
+ + " return factory.createProtocol();" + NL + " }" + NL + "" + NL
+ + " protected void fireChannelOpened(Channel channel)" + NL + " {" + NL
+ + " for (ChannelListener listener : channelListeners)" + NL + " {" + NL + " try" + NL + " {"
+ + NL + " listener.notifyChannelOpened(channel);" + NL + " }" + NL + " catch (Exception ex)"
+ + NL + " {" + NL + " ex.printStackTrace();" + NL + " }" + NL + " }" + NL + " }" + NL + ""
+ + NL + " protected void fireChannelClosing(Channel channel)" + NL + " {" + NL
+ + " for (ChannelListener listener : channelListeners)" + NL + " {" + NL + " try" + NL + " {"
+ + NL + " listener.notifyChannelClosing(channel);" + NL + " }" + NL + " catch (Exception ex)"
+ + NL + " {" + NL + " ex.printStackTrace();" + NL + " }" + NL + " }" + NL + " }" + NL + ""
+ + NL + " protected void fireStateChanged(State newState, State oldState)" + NL + " {" + NL
+ + " for (StateListener listener : stateListeners)" + NL + " {" + NL + " try" + NL + " {" + NL
+ + " listener.notifyStateChanged(this, newState, oldState);" + NL + " }" + NL
+ + " catch (Exception ex)" + NL + " {" + NL + " ex.printStackTrace();" + NL + " }" + NL
+ + " }" + NL + " }" + NL + "" + NL + " @Override" + NL
+ + " protected void onAccessBeforeActivate() throws Exception" + NL + " {" + NL
+ + " super.onAccessBeforeActivate();" + NL + " if (bufferProvider == null)" + NL + " {" + NL
+ + " throw new IllegalStateException(\"bufferProvider == null\");" + NL + " }" + NL + "" + NL
+ + " if (protocolFactoryRegistry == null)" + NL + " {" + NL
+ + " System.out.println(toString() + \": (INFO) protocolFactoryRegistry == null\");" + NL + " }" + NL
+ + "" + NL + " if (receiveExecutor == null)" + NL + " {" + NL
+ + " System.out.println(toString() + \": (INFO) receiveExecutor == null\");" + NL + " }" + NL + " }"
+ + NL + "" + NL + " @Override" + NL + " protected void onActivate() throws Exception" + NL + " {" + NL
+ + " super.onActivate();" + NL + " setState(State.CONNECTING);" + NL + " }" + NL + "" + NL
+ + " @Override" + NL + " protected void onDeactivate() throws Exception" + NL + " {" + NL
+ + " setState(State.DISCONNECTED);" + NL + " for (short i = 0; i < channels.size(); i++)" + NL + " {"
+ + NL + " ChannelImpl channel = channels.get(i);" + NL + " if (channel != null)" + NL + " {" + NL
+ + " LifecycleUtil.deactivate(channel);" + NL + " }" + NL + " }" + NL + "" + NL
+ + " channels.clear();" + NL + " super.onDeactivate();" + NL + " }" + NL + "" + NL
+ + " protected abstract void registerChannelWithPeer(short channelIndex, String protocolID)" + NL
+ + " throws ConnectorException;" + NL + "" + NL + " /**" + NL
+ + " * Is registered with each {@link Channel} of this {@link Connector}." + NL + " * <p>" + NL + " * "
+ + NL + " * @author Eike Stepper" + NL + " */" + NL
+ + " private final class ChannelLifecycleListener implements LifecycleListener" + NL + " {" + NL
+ + " public void notifyLifecycleActivated(LifecycleNotifier notifier)" + NL + " {" + NL
+ + " ChannelImpl channel = (ChannelImpl)notifier;" + NL + " fireChannelOpened(channel);" + NL
+ + " }" + NL + "" + NL + " public void notifyLifecycleDeactivating(LifecycleNotifier notifier)" + NL
+ " {" + NL + " ChannelImpl channel = (ChannelImpl)notifier;" + NL
- + " fireChannelOpened(channel);" + NL + " }" + NL + "" + NL
- + " public void notifyLifecycleDeactivating(LifecycleNotifier notifier)" + NL + " {"
- + NL + " ChannelImpl channel = (ChannelImpl)notifier;" + NL
- + " fireChannelClosing(channel);" + NL + " removeChannel(channel);" + NL
- + " }" + NL + " }" + NL + "}" + NL;
+ + " fireChannelClosing(channel);" + NL + " removeChannel(channel);" + NL + " }" + NL + " }" + NL
+ + "}" + NL;
}
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
index 6033dcc..3380ce9 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
@@ -55,8 +55,7 @@ public class SignalTest extends AbstractOMTest
assertTrue(selector.isActive());
acceptor = (TCPAcceptorImpl)Net4jUtil.createTCPAcceptor(bufferPool, selector);
- connector = (AbstractTCPConnector)Net4jUtil.createTCPConnector(bufferPool, selector,
- "localhost");
+ connector = (AbstractTCPConnector)Net4jUtil.createTCPConnector(bufferPool, selector, "localhost");
}
@Override
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java
index 2f2cb12..c4da8d1 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPTransportTest.java
@@ -67,8 +67,7 @@ public class TCPTransportTest extends AbstractOMTest
assertTrue(selector.isActive());
acceptor = (TCPAcceptorImpl)Net4jUtil.createTCPAcceptor(bufferPool, selector);
- connector = (AbstractTCPConnector)Net4jUtil.createTCPConnector(bufferPool, selector,
- "localhost");
+ connector = (AbstractTCPConnector)Net4jUtil.createTCPConnector(bufferPool, selector, "localhost");
System.out.println("---------------- START ----------------");
}
diff --git a/plugins/org.eclipse.net4j/.options b/plugins/org.eclipse.net4j/.options
index 2d09c1c..d4803f3 100644
--- a/plugins/org.eclipse.net4j/.options
+++ b/plugins/org.eclipse.net4j/.options
@@ -1,4 +1,4 @@
-org.eclipse.net4j/debug = false
+org.eclipse.net4j/debug = true
org.eclipse.net4j/debug.lifecycle = true
org.eclipse.net4j/debug.lifecycle.dump = true
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/LegacyBundle.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/LegacyBundle.java
index 548249c..e6f0cf9 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/LegacyBundle.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/LegacyBundle.java
@@ -163,8 +163,7 @@ public class LegacyBundle extends AbstractOMBundle
// If we still don't have a good base URL, complain about it.
if (baseURL == null)
{
- String resourceName = ReflectUtil.getPackageName(className).replace('.', '/')
- + "/plugin.properties"; //$NON-NLS-1$
+ String resourceName = ReflectUtil.getPackageName(className).replace('.', '/') + "/plugin.properties"; //$NON-NLS-1$
throw new MissingResourceException("Missing properties: " + resourceName, accessor.getName(), //$NON-NLS-1$
"plugin.properties"); //$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java
index acdc13c..de9bdc4 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractConnector.java
@@ -39,11 +39,9 @@ import java.util.concurrent.TimeUnit;
/**
* @author Eike Stepper
*/
-public abstract class AbstractConnector extends AbstractLifecycle implements Connector,
- BufferProvider
+public abstract class AbstractConnector extends AbstractLifecycle implements Connector, BufferProvider
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR,
- AbstractConnector.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR, AbstractConnector.class);
private static final ChannelImpl NULL_CHANNEL = new ChannelImpl(null)
{
@@ -616,8 +614,7 @@ public abstract class AbstractConnector extends AbstractLifecycle implements Con
super.onDeactivate();
}
- protected abstract void registerChannelWithPeer(short channelIndex, String protocolID)
- throws ConnectorException;
+ protected abstract void registerChannelWithPeer(short channelIndex, String protocolID) throws ConnectorException;
private static int getNextConnectorID()
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocol.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocol.java
index 67ec05d..2ed8e41 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/AbstractProtocol.java
@@ -19,8 +19,7 @@ import org.eclipse.net4j.util.lifecycle.AbstractLifecycle;
/**
* @author Eike Stepper
*/
-public abstract class AbstractProtocol extends AbstractLifecycle implements Protocol,
- BufferProvider
+public abstract class AbstractProtocol extends AbstractLifecycle implements Protocol, BufferProvider
{
private Channel channel;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactoryImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactoryImpl.java
index befd995..b9d1246 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactoryImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferFactoryImpl.java
@@ -20,8 +20,7 @@ import org.eclipse.internal.net4j.bundle.Net4j;
*/
public class BufferFactoryImpl extends BufferProviderImpl
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER,
- BufferFactoryImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, BufferFactoryImpl.class);
public BufferFactoryImpl(short bufferCapacity)
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferImpl.java
index 9f61513..ba1e99e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferImpl.java
@@ -34,8 +34,7 @@ public class BufferImpl implements Buffer
private static final int EOS_OFFSET = 1;
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER,
- BufferImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, BufferImpl.class);
private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPoolImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPoolImpl.java
index 81c428e..cf4ecfd 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPoolImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/BufferPoolImpl.java
@@ -23,11 +23,9 @@ import java.util.concurrent.ConcurrentLinkedQueue;
/**
* @author Eike Stepper
*/
-public class BufferPoolImpl extends BufferProviderImpl implements BufferPool,
- BufferPool.Introspection
+public class BufferPoolImpl extends BufferProviderImpl implements BufferPool, BufferPool.Introspection
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER,
- BufferPoolImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER, BufferPoolImpl.class);
private final BufferProvider factory;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ChannelImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ChannelImpl.java
index 369874b..8917ba3 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ChannelImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/ChannelImpl.java
@@ -36,8 +36,7 @@ import java.util.concurrent.ExecutorService;
*/
public class ChannelImpl extends AbstractLifecycle implements Channel, BufferProvider
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CHANNEL,
- ChannelImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CHANNEL, ChannelImpl.class);
private short channelIndex = BufferImpl.NO_CHANNEL;
@@ -149,6 +148,11 @@ public class ChannelImpl extends AbstractLifecycle implements Channel, BufferPro
TRACER.format("Handling buffer from client: {0} --> {1}", buffer, this); //$NON-NLS-1$
}
+ if (sendQueue == null)
+ {
+ throw new IllegalStateException("sendQueue == null");
+ }
+
sendQueue.add(buffer);
connector.multiplexBuffer(this);
}
@@ -256,8 +260,7 @@ public class ChannelImpl extends AbstractLifecycle implements Channel, BufferPro
if (obj instanceof ChannelID)
{
ChannelID that = (ChannelID)obj;
- return channelIndex == that.getChannelIndex()
- && ObjectUtil.equals(connector, that.getConnector());
+ return channelIndex == that.getChannelIndex() && ObjectUtil.equals(connector, that.getConnector());
}
return false;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/AbstractEmbeddedConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/AbstractEmbeddedConnector.java
index 1cda337..e5dc705 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/AbstractEmbeddedConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/AbstractEmbeddedConnector.java
@@ -43,8 +43,7 @@ public abstract class AbstractEmbeddedConnector extends AbstractConnector
}
@Override
- protected void registerChannelWithPeer(short channelIndex, String protocolID)
- throws ConnectorException
+ protected void registerChannelWithPeer(short channelIndex, String protocolID) throws ConnectorException
{
try
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java
index faa9406..30eb4fd 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/embedded/ClientEmbeddedConnectorImpl.java
@@ -17,8 +17,7 @@ import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
/**
* @author Eike Stepper
*/
-public class ClientEmbeddedConnectorImpl extends AbstractEmbeddedConnector implements
- LifecycleListener
+public class ClientEmbeddedConnectorImpl extends AbstractEmbeddedConnector implements LifecycleListener
{
public ClientEmbeddedConnectorImpl()
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java
index aab164b..e48fef9 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/AbstractTCPConnector.java
@@ -38,8 +38,7 @@ import java.util.Queue;
public abstract class AbstractTCPConnector extends AbstractConnector implements TCPConnector,
TCPSelectorListener.Active
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR,
- AbstractTCPConnector.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CONNECTOR, AbstractTCPConnector.class);
private SocketChannel socketChannel;
@@ -240,8 +239,7 @@ public abstract class AbstractTCPConnector extends AbstractConnector implements
}
@Override
- protected void registerChannelWithPeer(short channelIndex, String protocolID)
- throws ConnectorException
+ protected void registerChannelWithPeer(short channelIndex, String protocolID) throws ConnectorException
{
try
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ControlChannelImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ControlChannelImpl.java
index ebca313..0f2e955 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ControlChannelImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ControlChannelImpl.java
@@ -40,8 +40,7 @@ public final class ControlChannelImpl extends ChannelImpl
public static final byte FAILURE = 0;
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CHANNEL,
- ControlChannelImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_CHANNEL, ControlChannelImpl.class);
private SynchronizingCorrelator<Short, Boolean> registrations = new SynchronizingCorrelator();
@@ -104,8 +103,7 @@ public final class ControlChannelImpl extends ChannelImpl
{
byte[] handlerFactoryUTF8 = BufferUtil.getByteArray(byteBuffer);
String protocolID = BufferUtil.fromUTF8(handlerFactoryUTF8);
- ChannelImpl channel = ((AbstractTCPConnector)getConnector()).createChannel(channelIndex,
- protocolID, null);
+ ChannelImpl channel = ((AbstractTCPConnector)getConnector()).createChannel(channelIndex, protocolID, null);
if (channel != null)
{
channel.activate();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ServerTCPConnectorImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ServerTCPConnectorImpl.java
index 8043e0b..5d55adc 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ServerTCPConnectorImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/ServerTCPConnectorImpl.java
@@ -25,8 +25,7 @@ import java.util.concurrent.ExecutorService;
public class ServerTCPConnectorImpl extends AbstractTCPConnector
{
public ServerTCPConnectorImpl(SocketChannel socketChannel, ExecutorService receiveExecutor,
- IRegistry<String, ProtocolFactory> protocolFactoryRegistry, BufferProvider bufferProvider,
- TCPSelector selector)
+ IRegistry<String, ProtocolFactory> protocolFactoryRegistry, BufferProvider bufferProvider, TCPSelector selector)
{
super(socketChannel);
setReceiveExecutor(receiveExecutor);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java
index 9668bfc..21ac6b6 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java
@@ -49,8 +49,7 @@ import java.util.concurrent.ExecutorService;
public class TCPAcceptorImpl extends AbstractLifecycle implements TCPAcceptor, BufferProvider,
TCPSelectorListener.Passive, LifecycleListener
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR,
- TCPAcceptorImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_ACCEPTOR, TCPAcceptorImpl.class);
private IRegistry<String, ProtocolFactory> protocolFactoryRegistry;
@@ -268,8 +267,8 @@ public class TCPAcceptorImpl extends AbstractLifecycle implements TCPAcceptor, B
protected AbstractTCPConnector createConnector(SocketChannel socketChannel)
{
- return new ServerTCPConnectorImpl(socketChannel, getReceiveExecutor(),
- getProtocolFactoryRegistry(), bufferProvider, selector);
+ return new ServerTCPConnectorImpl(socketChannel, getReceiveExecutor(), getProtocolFactoryRegistry(),
+ bufferProvider, selector);
}
protected void fireConnectorAccepted(TCPConnector connector)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPSelectorImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPSelectorImpl.java
index e75fd18..72a7a6a 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPSelectorImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPSelectorImpl.java
@@ -37,8 +37,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
*/
public class TCPSelectorImpl extends AbstractLifecycle implements TCPSelector, Runnable
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SELECTOR,
- TCPSelectorImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SELECTOR, TCPSelectorImpl.class);
private Selector selector;
@@ -335,8 +334,7 @@ public class TCPSelectorImpl extends AbstractLifecycle implements TCPSelector, R
}
}
- private void doRegister(final ServerSocketChannel channel,
- final TCPSelectorListener.Passive listener)
+ private void doRegister(final ServerSocketChannel channel, final TCPSelectorListener.Passive listener)
{
if (TRACER.isEnabled())
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Indication.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Indication.java
index e5d4fe7..2c49e0c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Indication.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Indication.java
@@ -12,6 +12,7 @@ package org.eclipse.net4j.signal;
import org.eclipse.net4j.stream.BufferInputStream;
import org.eclipse.net4j.stream.BufferOutputStream;
+import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
@@ -24,8 +25,7 @@ import java.io.IOException;
*/
public abstract class Indication extends SignalReactor
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL,
- Indication.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL, Indication.class);
protected Indication()
{
@@ -36,7 +36,7 @@ public abstract class Indication extends SignalReactor
{
if (TRACER.isEnabled())
{
- TRACER.trace("================ Indicating"); //$NON-NLS-1$
+ TRACER.trace("================ Indicating " + ReflectUtil.getSimpleClassName(this)); //$NON-NLS-1$
}
indicating(new ExtendedDataInputStream(in));
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IndicationWithResponse.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IndicationWithResponse.java
index 51429f3..38a133d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IndicationWithResponse.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/IndicationWithResponse.java
@@ -26,8 +26,7 @@ import java.io.IOException;
*/
public abstract class IndicationWithResponse extends SignalReactor
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL,
- IndicationWithResponse.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL, IndicationWithResponse.class);
protected IndicationWithResponse()
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java
index c3d7a76..3f2111b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Request.java
@@ -13,6 +13,7 @@ package org.eclipse.net4j.signal;
import org.eclipse.net4j.stream.BufferInputStream;
import org.eclipse.net4j.stream.BufferOutputStream;
import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.util.ReflectUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
@@ -37,7 +38,7 @@ public abstract class Request extends SignalActor
{
if (TRACER.isEnabled())
{
- TRACER.trace("================ Requesting"); //$NON-NLS-1$
+ TRACER.trace("================ Requesting " + ReflectUtil.getSimpleClassName(this)); //$NON-NLS-1$
}
requesting(new ExtendedDataOutputStream(out));
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java
index d3656bd..2341b7a 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/RequestWithConfirmation.java
@@ -27,8 +27,7 @@ import java.io.IOException;
*/
public abstract class RequestWithConfirmation<RESULT> extends SignalActor<RESULT>
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL,
- RequestWithConfirmation.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL, RequestWithConfirmation.class);
protected RequestWithConfirmation(Channel channel)
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java
index 62d1b5d..e6300cc 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalActor.java
@@ -53,8 +53,7 @@ public abstract class SignalActor<RESULT> extends Signal
@Override
public String toString()
{
- return ReflectUtil.getSimpleName(getClass())
- + "[" + getSignalID() + ", " + getProtocol() + ", correlation=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return ReflectUtil.getSimpleName(getClass()) + "[" + getSignalID() + ", " + getProtocol() + ", correlation=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ getCorrelationID() + (terminated ? ", SENT" : "") + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java
index 233e443..c34af19 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalProtocol.java
@@ -38,8 +38,7 @@ public abstract class SignalProtocol extends AbstractProtocol
private static final int MAX_CORRELATION_ID = Integer.MAX_VALUE;
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL,
- SignalProtocol.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_SIGNAL, SignalProtocol.class);
private static final ContextTracer STREAM_TRACER = new ContextTracer(Net4j.DEBUG_BUFFER_STREAM,
SignalOutputStream.class);
@@ -220,8 +219,7 @@ public abstract class SignalProtocol extends AbstractProtocol
*/
class SignalOutputStream extends ChannelOutputStream
{
- public SignalOutputStream(final int correlationID, final short signalID,
- final boolean addSignalID)
+ public SignalOutputStream(final int correlationID, final short signalID, final boolean addSignalID)
{
super(getChannel(), new BufferProvider()
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalReactor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalReactor.java
index ee2b28e..9d09532 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalReactor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalReactor.java
@@ -24,8 +24,7 @@ public abstract class SignalReactor extends Signal
@Override
public String toString()
{
- return ReflectUtil.getSimpleName(getClass())
- + "[" + getSignalID() + ", " + getProtocol() + ", correlation=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return ReflectUtil.getSimpleName(getClass()) + "[" + getSignalID() + ", " + getProtocol() + ", correlation=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ getCorrelationID() + "]"; //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java
index d8b1623..4d7c8da 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferInputStream.java
@@ -34,8 +34,7 @@ public class BufferInputStream extends InputStream implements BufferHandler
public static final long DEFAULT_MILLIS_INTERRUPT_CHECK = 100;
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER_STREAM,
- BufferInputStream.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER_STREAM, BufferInputStream.class);
private BlockingQueue<Buffer> buffers = new LinkedBlockingQueue();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java
index 77da26a..a13e2ed 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/stream/BufferOutputStream.java
@@ -30,8 +30,7 @@ public class BufferOutputStream extends OutputStream
{
public static final boolean DEFAULT_PROPAGATE_CLOSE = false;
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER_STREAM,
- BufferOutputStream.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_BUFFER_STREAM, BufferOutputStream.class);
private BufferHandler bufferHandler;
@@ -41,8 +40,7 @@ public class BufferOutputStream extends OutputStream
private short channelIndex;
- public BufferOutputStream(BufferHandler bufferHandler, BufferProvider bufferProvider,
- short channelIndex)
+ public BufferOutputStream(BufferHandler bufferHandler, BufferProvider bufferProvider, short channelIndex)
{
if (bufferHandler == null)
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Channel.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Channel.java
index 1bb7395..bd8f20c 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Channel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Channel.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.transport;
+import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.net4j.util.registry.HashMapRegistry;
import org.eclipse.net4j.util.registry.IRegistry;
@@ -27,6 +28,7 @@ import org.eclipse.net4j.util.registry.IRegistry;
*/
public interface Channel extends BufferHandler
{
+ @Singleton
public static final IRegistry<ChannelID, Channel> REGISTRY = new HashMapRegistry();
public short getChannelIndex();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Connector.java
index b21e3bd..282fb51 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/Connector.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.transport;
+import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.net4j.util.registry.HashMapRegistry;
import org.eclipse.net4j.util.registry.IRegistry;
@@ -36,6 +37,7 @@ import java.util.concurrent.ExecutorService;
*/
public interface Connector
{
+ @Singleton
public static final IRegistry<Integer, Connector> REGISTRY = new HashMapRegistry();
public Integer getID();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactory.java
index 2f06f3d..891312f 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/ProtocolFactory.java
@@ -11,6 +11,7 @@
package org.eclipse.net4j.transport;
import org.eclipse.net4j.transport.Connector.Type;
+import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.internal.net4j.transport.ClientProtocolFactoryRegistry;
import org.eclipse.internal.net4j.transport.ServerProtocolFactoryRegistry;
@@ -25,16 +26,18 @@ import java.util.Set;
*/
public interface ProtocolFactory
{
+ @Singleton
public static final ClientProtocolFactoryRegistry CLIENT_REGISTRY = new ClientProtocolFactoryRegistry();
+ @Singleton
public static final ServerProtocolFactoryRegistry SERVER_REGISTRY = new ServerProtocolFactoryRegistry();
public static final Set<Type> FOR_CLIENTS = Collections.singleton(Type.CLIENT);
public static final Set<Type> FOR_SERVERS = Collections.singleton(Type.SERVER);
- public static final Set<Type> SYMMETRIC = Collections.unmodifiableSet(new HashSet(Arrays
- .asList(new Type[] { Type.CLIENT, Type.SERVER })));
+ public static final Set<Type> SYMMETRIC = Collections.unmodifiableSet(new HashSet(Arrays.asList(new Type[] {
+ Type.CLIENT, Type.SERVER })));
public String getProtocolID();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/HexUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/HexUtil.java
index b800113..1b8a417 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/HexUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/HexUtil.java
@@ -15,8 +15,7 @@ package org.eclipse.net4j.util;
*/
public final class HexUtil
{
- public static final char DIGITS[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b',
- 'c', 'd', 'e', 'f', };
+ public static final char DIGITS[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', };
private HexUtil()
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/Net4jUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/Net4jUtil.java
index e4a8c8d..81d4871 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/Net4jUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/Net4jUtil.java
@@ -74,8 +74,8 @@ public final class Net4jUtil
return connector;
}
- public static TCPAcceptor createTCPAcceptor(BufferProvider bufferProvider, TCPSelector selector,
- String address, int port)
+ public static TCPAcceptor createTCPAcceptor(BufferProvider bufferProvider, TCPSelector selector, String address,
+ int port)
{
TCPAcceptorImpl acceptor = new TCPAcceptorImpl();
acceptor.setBufferProvider(bufferProvider);
@@ -87,12 +87,11 @@ public final class Net4jUtil
public static TCPAcceptor createTCPAcceptor(BufferProvider bufferProvider, TCPSelector selector)
{
- return createTCPAcceptor(bufferProvider, selector, TCPAcceptor.DEFAULT_ADDRESS,
- TCPAcceptor.DEFAULT_PORT);
+ return createTCPAcceptor(bufferProvider, selector, TCPAcceptor.DEFAULT_ADDRESS, TCPAcceptor.DEFAULT_PORT);
}
- public static TCPConnector createTCPConnector(BufferProvider bufferProvider,
- TCPSelector selector, String host, int port)
+ public static TCPConnector createTCPConnector(BufferProvider bufferProvider, TCPSelector selector, String host,
+ int port)
{
ClientTCPConnectorImpl connector = new ClientTCPConnectorImpl();
connector.setBufferProvider(bufferProvider);
@@ -102,8 +101,7 @@ public final class Net4jUtil
return connector;
}
- public static TCPConnector createTCPConnector(BufferProvider bufferProvider,
- TCPSelector selector, String host)
+ public static TCPConnector createTCPConnector(BufferProvider bufferProvider, TCPSelector selector, String host)
{
return createTCPConnector(bufferProvider, selector, host, TCPConnector.DEFAULT_PORT);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java
index ec3f609..8fe246b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/ReflectUtil.java
@@ -172,8 +172,7 @@ public final class ReflectUtil
return builder.toString();
}
- private static void toString(Class<? extends Object> segment, Object object, String prefix,
- StringBuilder builder)
+ private static void toString(Class<? extends Object> segment, Object object, String prefix, StringBuilder builder)
{
if (segment == ROOT_CLASS || segment == AbstractLifecycle.class)
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java
index 55d8b13..41fc94b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java
@@ -16,8 +16,7 @@ import java.util.concurrent.ConcurrentMap;
/**
* @author Eike Stepper
*/
-public class SynchronizingCorrelator<CORRELATION, RESULT> implements
- Correlator<CORRELATION, Synchronizer<RESULT>>
+public class SynchronizingCorrelator<CORRELATION, RESULT> implements Correlator<CORRELATION, Synchronizer<RESULT>>
{
private ConcurrentMap<CORRELATION, Synchronizer<RESULT>> map = new ConcurrentHashMap(0);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/AbstractLifecycle.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/AbstractLifecycle.java
index 5b311e6..013494d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/AbstractLifecycle.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/AbstractLifecycle.java
@@ -25,11 +25,9 @@ public abstract class AbstractLifecycle implements Lifecycle, LifecycleNotifier
{
public static boolean USE_LABEL = true;
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_LIFECYCLE,
- AbstractLifecycle.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_LIFECYCLE, AbstractLifecycle.class);
- private static final ContextTracer DUMPER = new ContextTracer(Net4j.DEBUG_LIFECYCLE_DUMP,
- AbstractLifecycle.class);
+ private static final ContextTracer DUMPER = new ContextTracer(Net4j.DEBUG_LIFECYCLE_DUMP, AbstractLifecycle.class);
private boolean active;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
index 47daab5..785f174 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java
@@ -22,8 +22,7 @@ import java.lang.reflect.Method;
*/
public final class LifecycleUtil
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_LIFECYCLE,
- LifecycleUtil.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_LIFECYCLE, LifecycleUtil.class);
private LifecycleUtil()
{
@@ -130,8 +129,8 @@ public final class LifecycleUtil
if (annotation != null)
{
invokeMethod(object, method);
- boolean propagate = annotationClass == Activator.class ? ((Activator)annotation)
- .propagate() : ((Deactivator)annotation).propagate();
+ boolean propagate = annotationClass == Activator.class ? ((Activator)annotation).propagate()
+ : ((Deactivator)annotation).propagate();
if (!propagate)
{
break;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Singleton.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Singleton.java
new file mode 100644
index 0000000..23c8989
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Singleton.java
@@ -0,0 +1,25 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.net4j.util.lifecycle;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Eike Stepper
+ */
+@Retention(RetentionPolicy.SOURCE)
+@Target(ElementType.FIELD)
+public @interface Singleton
+{
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java
index ee1a754..331c462 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/OMPlatform.java
@@ -10,6 +10,8 @@
**************************************************************************/
package org.eclipse.net4j.util.om;
+import org.eclipse.net4j.util.lifecycle.Singleton;
+
import org.eclipse.internal.net4j.bundle.AbstractOMPlatform;
/**
@@ -17,6 +19,7 @@ import org.eclipse.internal.net4j.bundle.AbstractOMPlatform;
*/
public interface OMPlatform
{
+ @Singleton
public static final OMPlatform INSTANCE = AbstractOMPlatform.createPlatform();
public OMBundle bundle(String bundleID, Class accessor);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java
index 01c8a6c..902cbb8 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.util.om.log;
+import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.net4j.util.om.OMLogHandler;
import org.eclipse.net4j.util.om.OMLogger;
import org.eclipse.net4j.util.om.OMLogger.Level;
@@ -27,10 +28,10 @@ import org.eclipse.internal.net4j.bundle.OSGiBundle;
*/
public class EclipseLoggingBridge implements OMLogHandler
{
+ @Singleton
public static final EclipseLoggingBridge INSTANCE = new EclipseLoggingBridge();
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_OM,
- EclipseLoggingBridge.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_OM, EclipseLoggingBridge.class);
protected EclipseLoggingBridge()
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java
index 0a8e9b8..8c36c6e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.util.om.log;
+import org.eclipse.net4j.util.lifecycle.Singleton;
import org.eclipse.net4j.util.om.OMLogHandler;
import org.eclipse.net4j.util.om.OMLogger;
import org.eclipse.net4j.util.om.OMLogger.Level;
@@ -27,10 +28,10 @@ import org.osgi.service.log.LogService;
*/
public class OSGiLoggingBridge implements OMLogHandler
{
+ @Singleton
public static final OSGiLoggingBridge INSTANCE = new OSGiLoggingBridge();
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_OM,
- OSGiLoggingBridge.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_OM, OSGiLoggingBridge.class);
protected OSGiLoggingBridge()
{
@@ -52,8 +53,7 @@ public class OSGiLoggingBridge implements OMLogHandler
}
}
- public void logged(BundleContext bundleContext, Level level, String msg, Throwable t)
- throws Exception
+ public void logged(BundleContext bundleContext, Level level, String msg, Throwable t) throws Exception
{
LogService logService = getLogService(bundleContext);
logService.log(toOSGi(level), msg, t);
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java
index 499f70f..1eaa82e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java
@@ -30,8 +30,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
*/
public abstract class AbstractRegistry<K, V> implements IRegistry<K, V>
{
- private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_REGISTRY,
- AbstractRegistry.class);
+ private static final ContextTracer TRACER = new ContextTracer(Net4j.DEBUG_REGISTRY, AbstractRegistry.class);
/**
* Don't initialize lazily to circumvent synchronization!