Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McDuff2008-08-08 17:40:57 -0400
committerSimon McDuff2008-08-08 17:40:57 -0400
commitfeb16534f639544ee1e34f41f94d625c93af48ca (patch)
tree8c7114da2332fcaecfb669297fb6afbb218a840c
parenta2d241c6b62549d3ef86d1bd7c6a909061729ac9 (diff)
downloadcdo-feb16534f639544ee1e34f41f94d625c93af48ca.tar.gz
cdo-feb16534f639544ee1e34f41f94d625c93af48ca.tar.xz
cdo-feb16534f639544ee1e34f41f94d625c93af48ca.zip
[238414] Merge simon_pre_0_9 to HEAD
https://bugs.eclipse.org/bugs/show_bug.cgi?id=238414
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/query/CDOQueryQueue.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/BlockingCloseableIterator.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CloseableBlockingIterator.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/StateConcurrentQueue.java)53
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CloseableQueue.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/query/AbstractQueryResult.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java102
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryResult.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryCancelIndication.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryIndication.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java33
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavepoint.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavepointImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryCancelRequest.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java8
18 files changed, 171 insertions, 143 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/query/CDOQueryQueue.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/query/CDOQueryQueue.java
deleted file mode 100644
index 237e9377df..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/query/CDOQueryQueue.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 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:
- * Simon McDuff - initial API and implementation
- **************************************************************************/
-package org.eclipse.emf.cdo.common.query;
-
-import org.eclipse.emf.cdo.common.util.CloseableQueue;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public interface CDOQueryQueue<E> extends CloseableQueue<E>
-{
- void setException(Throwable exception);
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CloseableBlockingIterator.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/BlockingCloseableIterator.java
index 1419b810e9..0748312880 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CloseableBlockingIterator.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/BlockingCloseableIterator.java
@@ -16,7 +16,7 @@ import org.eclipse.net4j.util.collection.CloseableIterator;
* @author Simon McDuff
* @since 2.0
*/
-public interface CloseableBlockingIterator<T> extends CloseableIterator<T>
+public interface BlockingCloseableIterator<T> extends CloseableIterator<T>
{
/**
* Non-blocking call.
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/StateConcurrentQueue.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java
index 1874277420..1e6a70856a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/StateConcurrentQueue.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java
@@ -10,13 +10,13 @@
**************************************************************************/
package org.eclipse.emf.cdo.common.util;
-import org.eclipse.emf.cdo.common.query.CDOQueryQueue;
-
import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.collection.Closeable;
import java.util.Collection;
import java.util.Comparator;
-import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Queue;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
@@ -25,17 +25,17 @@ import java.util.concurrent.atomic.AtomicLong;
* @author Simon McDuff
* @since 2.0
*/
-public class StateConcurrentQueue<E> implements CDOQueryQueue<E>
+public class CDOQueryQueue<E> implements Queue<E>, Closeable
{
- private QueueEntry<E> QUEUE_CLOSED = new QueueEntry<E>();
-
private static final long serialVersionUID = 1L;
+ private QueueEntry<E> QUEUE_CLOSED = new QueueEntry<E>();
+
private PriorityBlockingQueue<QueueEntry<E>> queue;
private boolean closed = false;
- static class QueueEntry<E> implements java.util.Comparator<QueueEntry<E>>
+ static class QueueEntry<E> implements Comparable<QueueEntry<E>>
{
static AtomicLong nextSeq = new AtomicLong(0);
@@ -85,26 +85,26 @@ public class StateConcurrentQueue<E> implements CDOQueryQueue<E>
return null;
}
- public int compare(QueueEntry<E> o1, QueueEntry<E> o2)
+ public int compareTo(QueueEntry<E> o)
{
- if (o1.getException() != null)
+ if (getException() != null)
{
return -1;
}
- if (o2.getException() != null)
+ if (o.getException() != null)
{
return 1;
}
- if (o1 == o2)
+ if (this == o)
{
return 0;
}
- return (o1.seqNumber < o2.seqNumber ? -1 : 1);
+ return (seqNumber < o.seqNumber ? -1 : 1);
}
};
- public class CloseableBlockingIteratorImpl implements CloseableBlockingIterator<E>
+ public class CloseableBlockingIteratorImpl implements BlockingCloseableIterator<E>
{
private boolean closed = false;
@@ -112,20 +112,34 @@ public class StateConcurrentQueue<E> implements CDOQueryQueue<E>
public E peek()
{
-
if (nextElement == null)
{
- return StateConcurrentQueue.this.peek();
+ return CDOQueryQueue.this.peek();
}
return nextElement;
}
public boolean hasNext()
{
+ privateNext(false);
+ return nextElement != null;
+ }
+
+ private void privateNext(boolean failOnNull)
+ {
if (nextElement == null)
{
try
{
+ if (CDOQueryQueue.this.isEmpty() && CDOQueryQueue.this.isClosed())
+ {
+ if (failOnNull)
+ {
+ throw new NoSuchElementException();
+ }
+ return;
+ }
+
nextElement = take();
}
catch (InterruptedException ex)
@@ -133,13 +147,13 @@ public class StateConcurrentQueue<E> implements CDOQueryQueue<E>
Thread.currentThread().interrupt();
}
}
- return nextElement != null;
}
public E next()
{
try
{
+ privateNext(true);
return nextElement;
}
finally
@@ -165,15 +179,16 @@ public class StateConcurrentQueue<E> implements CDOQueryQueue<E>
}
- public StateConcurrentQueue()
+ public CDOQueryQueue()
{
- queue = new PriorityBlockingQueue<QueueEntry<E>>(10, new QueueEntry<E>());
+ queue = new PriorityBlockingQueue<QueueEntry<E>>(10);
}
public void setException(Throwable exception)
{
queue.add(new QueueEntry<E>(exception));
+
}
public void close()
@@ -259,7 +274,7 @@ public class StateConcurrentQueue<E> implements CDOQueryQueue<E>
return queue.isEmpty();
}
- public Iterator<E> iterator()
+ public BlockingCloseableIterator<E> iterator()
{
return new CloseableBlockingIteratorImpl();
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CloseableQueue.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CloseableQueue.java
deleted file mode 100644
index e474a93a49..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CloseableQueue.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 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.emf.cdo.common.util;
-
-import org.eclipse.net4j.util.collection.Closeable;
-
-import java.util.Queue;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public interface CloseableQueue<E> extends Queue<E>, Closeable
-{
-
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/query/AbstractQueryResult.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/query/AbstractQueryResult.java
index 63cc077963..f770724d71 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/query/AbstractQueryResult.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/query/AbstractQueryResult.java
@@ -12,9 +12,8 @@ package org.eclipse.emf.cdo.internal.common.query;
import org.eclipse.emf.cdo.common.CDOProtocolView;
import org.eclipse.emf.cdo.common.query.CDOQueryInfo;
-import org.eclipse.emf.cdo.common.query.CDOQueryQueue;
-import org.eclipse.emf.cdo.common.util.CloseableBlockingIterator;
-import org.eclipse.emf.cdo.common.util.StateConcurrentQueue;
+import org.eclipse.emf.cdo.common.util.BlockingCloseableIterator;
+import org.eclipse.emf.cdo.common.util.CDOQueryQueue;
import java.util.ArrayList;
import java.util.List;
@@ -23,19 +22,19 @@ import java.util.List;
* @author Simon McDuff
* @since 2.0
*/
-public class AbstractQueryResult<T> implements CloseableBlockingIterator<T>
+public class AbstractQueryResult<T> implements BlockingCloseableIterator<T>
{
- private long queryID;
+ private int queryID;
private CDOProtocolView view;
private CDOQueryInfo queryInfo;
- private StateConcurrentQueue<Object> linkQueue = new StateConcurrentQueue<Object>();
+ private CDOQueryQueue<Object> linkQueue = new CDOQueryQueue<Object>();
- private CloseableBlockingIterator<Object> queueItr = (CloseableBlockingIterator<Object>)linkQueue.iterator();
+ private BlockingCloseableIterator<Object> queueItr = linkQueue.iterator();
- public AbstractQueryResult(CDOProtocolView view, CDOQueryInfo queryInfo, long queryID)
+ public AbstractQueryResult(CDOProtocolView view, CDOQueryInfo queryInfo, int queryID)
{
this.queryID = queryID;
this.view = view;
@@ -57,12 +56,12 @@ public class AbstractQueryResult<T> implements CloseableBlockingIterator<T>
return view;
}
- public long getQueryID()
+ public int getQueryID()
{
return queryID;
}
- public void setQueryID(long queryID)
+ public void setQueryID(int queryID)
{
this.queryID = queryID;
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java
index c02b137706..41b2936608 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java
@@ -11,7 +11,7 @@
package org.eclipse.emf.cdo.internal.server;
import org.eclipse.emf.cdo.common.query.CDOQueryInfo;
-import org.eclipse.emf.cdo.common.query.CDOQueryQueue;
+import org.eclipse.emf.cdo.common.util.CDOQueryQueue;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.server.IStoreReader;
import org.eclipse.emf.cdo.server.IView;
@@ -39,37 +39,66 @@ public class QueryManager extends Lifecycle
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SESSION, QueryManager.class);
- private Map<Long, QueryContext> queryContexts = new ConcurrentHashMap<Long, QueryContext>();
+ private Map<Integer, QueryContext> queryContexts = new ConcurrentHashMap<Integer, QueryContext>();
- private Map<Long, Future<?>> associateThreads = new ConcurrentHashMap<Long, Future<?>>();
+ private ExecutorService executors;
- private ExecutorService executors = Executors.newFixedThreadPool(10);
-
- private long nextQuery = 0;
+ private int nextQuery = 0;
public QueryManager()
{
}
- synchronized long nextQuery()
+ synchronized int nextQuery()
{
return nextQuery++;
}
private Future<?> execute(QueryContext queryContext)
{
- Future<?> future = executors.submit(queryContext);
+ Future<?> future = getExecutors().submit(queryContext);
+ queryContext.setFuture(future);
- register(queryContext, future);
+ register(queryContext);
return future;
}
+ public ExecutorService getExecutors()
+ {
+ if (executors == null)
+ {
+ executors = Executors.newFixedThreadPool(10);
+ }
+ return executors;
+ }
+
+ public void setExecutors(ExecutorService executors)
+ {
+ }
+
class QueryContext implements Runnable
{
- QueryResult queryResult;
+ private QueryResult queryResult;
+
+ private Future<?> future;
- IListener listener = null;
+ IListener listener = new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof SingleDeltaContainerEvent)
+ {
+ IView view = (IView)getQueryResult().getView();
+ SingleDeltaContainerEvent<?> deltaEvent = (SingleDeltaContainerEvent<?>)event;
+ if (deltaEvent.getDeltaKind() == Kind.REMOVED && deltaEvent.getDeltaElement() == view)
+ {
+ // Cancel the query when view is closing
+ cancel(getQueryResult().getQueryID());
+ }
+ }
+ }
+ };;
IStoreReader reader = null;
@@ -82,35 +111,16 @@ public class QueryManager extends Lifecycle
private void removeListener()
{
final IView view = (IView)getQueryResult().getView();
+
view.getSession().removeListener(listener);
- listener = null;
}
private void addListener()
{
- if (listener == null)
- {
- final IView view = (IView)getQueryResult().getView();
-
- listener = new IListener()
- {
- public void notifyEvent(IEvent event)
- {
- if (event instanceof SingleDeltaContainerEvent)
- {
- SingleDeltaContainerEvent<?> deltaEvent = (SingleDeltaContainerEvent<?>)event;
- if (deltaEvent.getDeltaKind() == Kind.REMOVED && deltaEvent.getDeltaElement() == view)
- {
- // Cancel the query when view is closing
- cancel(getQueryResult().getQueryID());
- }
- }
- }
- };
+ final IView view = (IView)getQueryResult().getView();
- // Add listener to the session
- view.getSession().addListener(listener);
- }
+ // Add listener to the session
+ view.getSession().addListener(listener);
}
public void run()
@@ -155,6 +165,16 @@ public class QueryManager extends Lifecycle
{
return queryResult;
}
+
+ protected Future<?> getFuture()
+ {
+ return future;
+ }
+
+ protected void setFuture(Future<?> future)
+ {
+ this.future = future;
+ }
}
public QueryResult execute(IView view, CDOQueryInfo queryInfo)
@@ -169,36 +189,34 @@ public class QueryManager extends Lifecycle
return queryResult;
}
- public boolean isRunning(long queryID)
+ public boolean isRunning(int queryID)
{
QueryContext queryContext = queryContexts.get(queryID);
return queryContext != null;
}
- public void cancel(long queryID)
+ public void cancel(int queryID)
{
- Future<?> queryContext = associateThreads.get(queryID);
+ QueryContext queryContext = queryContexts.get(queryID);
- if (queryContext == null || queryContext.isDone())
+ if (queryContext == null || queryContext.getFuture().isDone())
throw new RuntimeException("Query " + queryID + " is not running anymore");
if (TRACER.isEnabled()) TRACER.trace("Stopping QueryNative thread: " + queryContext);
- queryContext.cancel(true);
+ queryContext.getFuture().cancel(true);
}
- synchronized public void register(final QueryContext queryContext, Future<?> future)
+ synchronized public void register(final QueryContext queryContext)
{
queryContexts.put(queryContext.getQueryResult().getQueryID(), queryContext);
- associateThreads.put(queryContext.getQueryResult().getQueryID(), future);
queryContext.addListener();
}
synchronized public void unregister(final QueryContext queryContext)
{
queryContexts.remove(queryContext.getQueryResult().getQueryID());
- associateThreads.remove(queryContext.getQueryResult().getQueryID());
queryContext.removeListener();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryResult.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryResult.java
index 33c35f424c..73423a3d63 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryResult.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryResult.java
@@ -20,7 +20,7 @@ import org.eclipse.emf.cdo.server.IView;
*/
public class QueryResult extends AbstractQueryResult<Object>
{
- public QueryResult(IView view, CDOQueryInfo parameter, long queryID)
+ public QueryResult(IView view, CDOQueryInfo parameter, int queryID)
{
super(view, parameter, queryID);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryCancelIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryCancelIndication.java
index 0769f12c7b..f4697cad8f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryCancelIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryCancelIndication.java
@@ -26,7 +26,7 @@ public class QueryCancelIndication extends CDOReadIndication
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryCancelIndication.class);
- private long queryID = -1;
+ private int queryID = -1;
public QueryCancelIndication()
{
@@ -43,7 +43,7 @@ public class QueryCancelIndication extends CDOReadIndication
protected void indicating(ExtendedDataInputStream in) throws IOException
{
- queryID = in.readLong();
+ queryID = in.readInt();
if (TRACER.isEnabled())
{
@@ -61,11 +61,11 @@ public class QueryCancelIndication extends CDOReadIndication
try
{
getRepository().getQueryManager().cancel(queryID);
- out.writeByte(0);
+ out.writeBoolean(false);
}
catch (Exception exception)
{
- out.writeByte(1);
+ out.writeBoolean(true);
out.writeString(exception.getMessage());
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryIndication.java
index f0db082c29..ee19bb5960 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryIndication.java
@@ -70,8 +70,9 @@ public class QueryIndication extends CDOReadIndication
int numberOfResult = 0;
// Return queryID immediately.
- out.writeLong(queryResult.getQueryID());
+ out.writeInt(queryResult.getQueryID());
out.flush();
+
while (queryResult.hasNext())
{
Object object = queryResult.next();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java
index 3cebe5ad86..870f48e272 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java
@@ -147,6 +147,39 @@ public class QueryTest extends AbstractCDOTest
}
+ public void testQueryAsync_UnsupportedLanguage() throws Exception
+ {
+ CDOTransaction transaction = initialize(100);
+
+ CDOQuery cdoQuery = transaction.createQuery(LANGUAGE_TEST + "ss", "QUERYSTRING");
+ try
+ {
+ CloseableIterator<Object> queryResult = cdoQuery.getResultAsync(Object.class);
+
+ queryResult.hasNext();
+ fail("Should throw an exception");
+ }
+ catch (Exception exception)
+ {
+ }
+ }
+
+ public void testQuerySync_UnsupportedLanguage() throws Exception
+ {
+ CDOTransaction transaction = initialize(100);
+
+ CDOQuery cdoQuery = transaction.createQuery(LANGUAGE_TEST + "ss", "QUERYSTRING");
+ try
+ {
+ List<Object> queryResult = cdoQuery.getResult(Object.class);
+ fail("Should throw an exception");
+ }
+ catch (Exception exception)
+ {
+
+ }
+ }
+
CDOTransaction initialize(int number)
{
CDOSession session = openModel1Session();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavepoint.java
index d59a9c038c..259f010747 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSavepoint.java
@@ -27,4 +27,6 @@ public interface CDOSavepoint
public boolean isValid();
public void rollback(boolean remote);
+
+ public void rollback();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavepointImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavepointImpl.java
index fae06df1a1..f93ad4e73f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavepointImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSavepointImpl.java
@@ -125,6 +125,11 @@ public class CDOSavepointImpl implements CDOSavepoint
getTransaction().rollback(this, remote);
}
+ public void rollback()
+ {
+ getTransaction().rollback(this);
+ }
+
public boolean isValid()
{
CDOSavepoint lastSavepoint = getTransaction().getLastSavepoint();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index 332fdf674d..aeacd32b3c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -215,7 +215,7 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession, CD
public IFailOverStrategy getFailOverStrategy()
{
- // DO NOT MERGE THAT
+ // TODO **************** DO NOT MERGE THAT
return failOverStrategy == null ? new NOOPFailOverStrategy() : failOverStrategy;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java
index 8c1f939e18..fd93c8eea6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java
@@ -10,8 +10,6 @@
**************************************************************************/
package org.eclipse.emf.internal.cdo.bundle;
-import org.eclipse.net4j.util.om.OSGiActivator;
-
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;
@@ -57,7 +55,7 @@ public final class Activator extends EMFPlugin
public void start(BundleContext context) throws Exception
{
super.start(context);
- // DO NOT MERGE THAT
+ // TODO **************** DO NOT MERGE THAT
// OSGiActivator.start(context);
}
@@ -65,7 +63,7 @@ public final class Activator extends EMFPlugin
public void stop(BundleContext context) throws Exception
{
plugin = null;
- // DO NOT MERGE THAT
+ // TODO **************** DO NOT MERGE THAT
// OSGiActivator.stopBundle(context, OM.BUNDLE);
super.stop(context);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryCancelRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryCancelRequest.java
index 3cc790e7ab..f153e43d40 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryCancelRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryCancelRequest.java
@@ -28,9 +28,9 @@ public class QueryCancelRequest extends CDOClientRequest<Object>
{
private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL, QueryCancelRequest.class);
- private long queryID;
+ private int queryID;
- public QueryCancelRequest(long queryID, IChannel channel)
+ public QueryCancelRequest(int queryID, IChannel channel)
{
super(channel);
this.queryID = queryID;
@@ -47,17 +47,17 @@ public class QueryCancelRequest extends CDOClientRequest<Object>
{
if (PROTOCOL.isEnabled()) PROTOCOL.trace("Cancel query " + queryID);
// Write queryID
- out.writeLong(queryID);
+ out.writeInt(queryID);
}
@Override
protected Object confirming(ExtendedDataInputStream in) throws IOException
{
- byte result = in.readByte();
- if (result == 1)
+ boolean exception = in.readBoolean();
+ if (exception)
{
- String exception = in.readString();
- throw new RuntimeException(exception);
+ String exceptionMessage = in.readString();
+ throw new RuntimeException(exceptionMessage);
}
return true;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java
index f4096255b2..3d47bd52ab 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java
@@ -11,8 +11,8 @@
package org.eclipse.emf.internal.cdo.protocol;
import org.eclipse.emf.cdo.common.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.query.CDOQueryQueue;
import org.eclipse.emf.cdo.common.util.CDOInstanceUtil;
+import org.eclipse.emf.cdo.common.util.CDOQueryQueue;
import org.eclipse.emf.cdo.internal.common.query.CDOQueryInfoImpl;
import org.eclipse.emf.internal.cdo.bundle.OM;
@@ -71,7 +71,7 @@ public class QueryRequest extends CDOClientRequest<Object>
List<Object> returnList = new ArrayList<Object>();
- queryResult.setQueryID(in.readLong());
+ queryResult.setQueryID(in.readInt());
CDOQueryQueue<Object> resulQueue = queryResult.getQueue();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java
index 18b356fa4c..50b13b6c1f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java
@@ -12,7 +12,7 @@ package org.eclipse.emf.internal.cdo.query;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.util.CloseableBlockingIterator;
+import org.eclipse.emf.cdo.common.util.BlockingCloseableIterator;
import org.eclipse.emf.cdo.internal.common.query.CDOQueryInfoImpl;
import org.eclipse.emf.cdo.query.CDOQuery;
@@ -77,10 +77,11 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery
return queryResult.getAsList();
}
- public <T> CloseableBlockingIterator<T> getResultAsync(Class<T> classObject)
+ public <T> BlockingCloseableIterator<T> getResultAsync(Class<T> classObject)
{
final CDOQueryInfoImpl queryInfo = createQueryInfo();
final CDOQueryResultIteratorImpl<T> queryResult = new CDOQueryResultIteratorImpl<T>(view, queryInfo);
+
final Exception exception[] = new Exception[1];
Runnable runnable = new Runnable()
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java
index 6b41b4914c..dd0f546f18 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java
@@ -23,17 +23,19 @@ import org.eclipse.emf.internal.cdo.protocol.QueryCancelRequest;
*/
public class CDOQueryResultIteratorImpl<T> extends AbstractQueryResult<T>
{
+ private static final int QUERYID_UNDEFINED = -1;
+
protected boolean closed = false;
- ConcurrentValue<Boolean> queryIDSet = new ConcurrentValue<Boolean>(false);
+ private ConcurrentValue<Boolean> queryIDSet = new ConcurrentValue<Boolean>(false);
public CDOQueryResultIteratorImpl(CDOView cdoView, CDOQueryInfo queryInfo)
{
- super(cdoView, queryInfo, -1);
+ super(cdoView, queryInfo, QUERYID_UNDEFINED);
}
@Override
- public void setQueryID(long queryID)
+ public void setQueryID(int queryID)
{
super.setQueryID(queryID);
queryIDSet.set(true);

Back to the top