Skip to content

Commit

Permalink
Cleanup jta removal leftovers
Browse files Browse the repository at this point in the history
Remove build dependencies, update tests to not reference jta api,
update shell documentation and class path entries.
Remove obsolete comments.
  • Loading branch information
MishaDemianenko committed May 24, 2016
1 parent 854461c commit ed44cc8
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 112 deletions.
Expand Up @@ -27,9 +27,7 @@
* If you attempt to access the graph outside of a transaction, those operations will throw * If you attempt to access the graph outside of a transaction, those operations will throw
* {@link NotInTransactionException}. * {@link NotInTransactionException}.
* <p> * <p>
* Transactions are bound to the thread in which they were created. Transactions can either be handled * Transactions are bound to the thread in which they were created.
* programmatically, through this interface, or by a container through the Java Transaction API (JTA). The
* Transaction interface makes handling programmatic transactions easier than using JTA programmatically.
* Here's the idiomatic use of programmatic transactions in Neo4j starting from java 7: * Here's the idiomatic use of programmatic transactions in Neo4j starting from java 7:
* *
* <pre> * <pre>
Expand Down
7 changes: 0 additions & 7 deletions community/kernel/pom.xml
Expand Up @@ -269,12 +269,5 @@ the relevant Commercial Agreement.
<type>test-jar</type> <type>test-jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>


<dependency>
<groupId>geronimo-spec</groupId>
<artifactId>geronimo-spec-j2ee</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
Expand Up @@ -168,7 +168,7 @@ public DependencyResolver get()
diagnosticsManager = life.add( dependencies.satisfyDependency( new DiagnosticsManager( logging.getInternalLog( diagnosticsManager = life.add( dependencies.satisfyDependency( new DiagnosticsManager( logging.getInternalLog(
DiagnosticsManager.class ) ) ) ); DiagnosticsManager.class ) ) ) );


// TODO please fix the bad dependencies instead of doing this. Before the removal of JTA // TODO please fix the bad dependencies instead of doing this.
// this was the place of the XaDataSourceManager. NeoStoreXaDataSource is create further down than // this was the place of the XaDataSourceManager. NeoStoreXaDataSource is create further down than
// (specifically) KernelExtensions, which creates an interesting out-of-order issue with #doAfterRecovery(). // (specifically) KernelExtensions, which creates an interesting out-of-order issue with #doAfterRecovery().
// Anyways please fix this. // Anyways please fix this.
Expand Down
Expand Up @@ -73,13 +73,6 @@
* keeping track of transaction state, serialization and deserialization to and from logical log, and applying things * keeping track of transaction state, serialization and deserialization to and from logical log, and applying things
* to store. It would most likely do this by keeping a component derived from the current WriteTransaction * to store. It would most likely do this by keeping a component derived from the current WriteTransaction
* implementation as a sub-component, responsible for handling logical log commands. * implementation as a sub-component, responsible for handling logical log commands.
*
* The class XAResourceManager plays in here as well, in that it shares responsibilities with WriteTransaction to
* write data to the logical log. As we continue to refactor this subsystem, XAResourceManager should ideally not know
* about the logical log, but defer entirely to the Kernel to handle this. Doing that will give the kernel full
* discretion to start experimenting with higher-performing logical log implementations, without being hindered by
* having to contend with the JTA compliance layers. In short, it would encapsulate the logical log/storage logic better
* and thus make it easier to change.
*/ */
public class TransactionRecordState implements RecordState public class TransactionRecordState implements RecordState
{ {
Expand Down
Expand Up @@ -61,41 +61,6 @@ public class KernelIT extends KernelIntegrationTest
{ {
// TODO: Split this into area-specific tests, see PropertyIT. // TODO: Split this into area-specific tests, see PropertyIT.


/**
* While we transition ownership from the Beans API to the Kernel API for core database
* interactions, there will be a bit of a mess. Our first goal is an architecture like this:
* <p>
* Users
* / \
* Beans API Cypher
* \ /
* Kernel API
* |
* Kernel Implementation
* <p>
* But our current intermediate architecture looks like this:
* <p>
* Users
* / \
* Beans API <--- Cypher
* | \ /
* | Kernel API
* | |
* Kernel Implementation
* <p>
* Meaning Kernel API and Beans API both manipulate the underlying kernel, causing lots of corner cases. Most
* notably, those corner cases are related to Transactions, and the interplay between three transaction APIs:
* - The Beans API
* - The JTA Transaction Manager API
* - The Kernel TransactionContext API
* <p>
* In the long term, the goal is for JTA compliant stuff to live outside of the kernel, as an addon. The Kernel
* API will rule supreme over the land of transactions. We are a long way away from there, however, so as a first
* intermediary step, the JTA transaction manager rules supreme, and the Kernel API piggybacks on it.
* <p>
* This test shows us how to use both the Kernel API and the Beans API together in the same transaction,
* during the transition phase.
*/
@Test @Test
public void mixingBeansApiWithKernelAPI() throws Exception public void mixingBeansApiWithKernelAPI() throws Exception
{ {
Expand All @@ -118,14 +83,6 @@ public void mixingBeansApiWithKernelAPI() throws Exception
// 5: Commit through the beans API // 5: Commit through the beans API
transaction.success(); transaction.success();
transaction.close(); transaction.close();

// NOTE: Transactions are still thread-bound right now, because we use JTA to "own" transactions,
// meaning if you use
// both the Kernel API to create transactions while a Beans API transaction is running in the same
// thread, the results are undefined.

// When the Kernel API implementation is done, the Kernel API transaction implementation is not meant
// to be bound to threads.
} }


@Test @Test
Expand Down
Expand Up @@ -26,14 +26,12 @@
import java.util.Random; import java.util.Random;
import java.util.Stack; import java.util.Stack;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import javax.transaction.Transaction;


import org.neo4j.kernel.DeadlockDetectedException; import org.neo4j.kernel.DeadlockDetectedException;


import static java.lang.System.currentTimeMillis; import static java.lang.System.currentTimeMillis;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;


@Ignore("Not a test, part of a compatibility suite.") @Ignore("Not a test, part of a compatibility suite.")
// This is the legacy deadlock detection tests // This is the legacy deadlock detection tests
Expand Down Expand Up @@ -163,7 +161,6 @@ public static class StressThread extends Thread
private final float readWriteRatio; private final float readWriteRatio;
private final Locks.Client lm; private final Locks.Client lm;
private volatile Exception error; private volatile Exception error;
private final Transaction tx = mock( Transaction.class );
public volatile Long startedWaiting = null; public volatile Long startedWaiting = null;


StressThread( String name, int numberOfIterations, int depthCount, StressThread( String name, int numberOfIterations, int depthCount,
Expand Down
Expand Up @@ -19,14 +19,8 @@
*/ */
package org.neo4j.kernel.impl.locking; package org.neo4j.kernel.impl.locking;


import javax.transaction.HeuristicMixedException; import org.neo4j.graphdb.PropertyContainer;
import javax.transaction.HeuristicRollbackException; import org.neo4j.graphdb.Transaction;
import javax.transaction.RollbackException;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.xa.XAResource;

import org.neo4j.kernel.impl.locking.community.LockManagerImpl; import org.neo4j.kernel.impl.locking.community.LockManagerImpl;
import org.neo4j.kernel.impl.locking.community.RagManager; import org.neo4j.kernel.impl.locking.community.RagManager;


Expand Down Expand Up @@ -305,48 +299,39 @@ public void release()


static class ThreadMark implements Transaction static class ThreadMark implements Transaction
{ {
@Override
public void commit()
throws HeuristicMixedException, HeuristicRollbackException, RollbackException, SecurityException,
SystemException
{
throw new UnsupportedOperationException( "not implemented" );
}


@Override @Override
public boolean delistResource( XAResource xaRes, int flag ) throws IllegalStateException, SystemException public void terminate()
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException("not implemented");
} }


@Override @Override
public boolean enlistResource( XAResource xaRes ) public void failure()
throws IllegalStateException, RollbackException, SystemException
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException("not implemented");
} }


@Override @Override
public int getStatus() throws SystemException public void success()
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException("not implemented");
} }


@Override @Override
public void registerSynchronization( Synchronization synch ) public void close()
throws IllegalStateException, RollbackException, SystemException
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException("not implemented");
} }


@Override @Override
public void rollback() throws IllegalStateException, SystemException public org.neo4j.graphdb.Lock acquireWriteLock( PropertyContainer entity )
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException("not implemented");
} }


@Override @Override
public void setRollbackOnly() throws IllegalStateException, SystemException public org.neo4j.graphdb.Lock acquireReadLock( PropertyContainer entity )
{ {
throw new UnsupportedOperationException( "not implemented" ); throw new UnsupportedOperationException( "not implemented" );
} }
Expand Down
Expand Up @@ -29,8 +29,8 @@
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.transaction.Transaction;


import org.neo4j.graphdb.Transaction;
import org.neo4j.kernel.DeadlockDetectedException; import org.neo4j.kernel.DeadlockDetectedException;
import org.neo4j.kernel.impl.locking.ResourceTypes; import org.neo4j.kernel.impl.locking.ResourceTypes;


Expand Down
2 changes: 1 addition & 1 deletion community/shell/README.txt
Expand Up @@ -12,5 +12,5 @@ Issue the following command:
java -jar neo4j-shell-{version}.jar java -jar neo4j-shell-{version}.jar


Make sure to replace {version} with the actual version. Make sure to replace {version} with the actual version.
The neo4j-kernel and geronimo jta jar files need to be in the The neo4j-kernel jar file need to be in the
same directory or on the classpath. same directory or on the classpath.
3 changes: 1 addition & 2 deletions community/shell/pom.xml
Expand Up @@ -24,7 +24,6 @@
</scm> </scm>


<properties> <properties>
<sun.jta.version>1.1</sun.jta.version>
<jline.groupId>jline</jline.groupId> <jline.groupId>jline</jline.groupId>
<jline.artifactId>jline</jline.artifactId> <jline.artifactId>jline</jline.artifactId>
<jline.version>2.12</jline.version> <jline.version>2.12</jline.version>
Expand Down Expand Up @@ -69,7 +68,7 @@ the relevant Commercial Agreement.
<packageName>org.neo4j.shell</packageName> <packageName>org.neo4j.shell</packageName>
</manifest> </manifest>
<manifestEntries> <manifestEntries>
<Class-Path>neo4j-kernel-${project.version}.jar neo4j-index-${project.version}.jar lucene-core-${lucene.version}.jar jta-${sun.jta.version}.jar ${jta.artifactId}-${jta.version}.jar jline-${jline.main.version}.jar <Class-Path>neo4j-kernel-${project.version}.jar neo4j-index-${project.version}.jar lucene-core-${lucene.version}.jar jline-${jline.main.version}.jar
${jline.artifactId}-${jline.version}.jar</Class-Path> ${jline.artifactId}-${jline.version}.jar</Class-Path>
<Agent-Class>org.neo4j.shell.StartClient</Agent-Class> <Agent-Class>org.neo4j.shell.StartClient</Agent-Class>
</manifestEntries> </manifestEntries>
Expand Down
3 changes: 2 additions & 1 deletion community/shell/src/docs/dev/shell.asciidoc
Expand Up @@ -59,7 +59,8 @@ neo4j-sh (0)$
=== Pointing the shell to a path === Pointing the shell to a path


To start the shell by just pointing it to a Neo4j store path you run the shell jar file. To start the shell by just pointing it to a Neo4j store path you run the shell jar file.
Given that the right neo4j-kernel-<version>.jar and jta jar files are in the same path as your neo4j-shell-<version>.jar file you run it with: Given that the right neo4j-kernel-<version>.jar is in the same path as your neo4j-shell-<version>.jar file you run it
with:
[source,plain] [source,plain]
---- ----
$ neo4j-shell -path path/to/neo4j-db $ neo4j-shell -path path/to/neo4j-db
Expand Down
15 changes: 0 additions & 15 deletions pom.xml
Expand Up @@ -19,9 +19,6 @@


<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jta.groupId>org.apache.geronimo.specs</jta.groupId>
<jta.artifactId>geronimo-jta_1.1_spec</jta.artifactId>
<jta.version>1.1.1</jta.version>
<pico.version>2.14.3</pico.version> <pico.version>2.14.3</pico.version>
<licensing.prepend.text>notice-agpl-prefix.txt</licensing.prepend.text> <licensing.prepend.text>notice-agpl-prefix.txt</licensing.prepend.text>
<licensing.phase>compile</licensing.phase> <licensing.phase>compile</licensing.phase>
Expand Down Expand Up @@ -509,12 +506,6 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- special -->
<dependency>
<groupId>${jta.groupId}</groupId>
<artifactId>${jta.artifactId}</artifactId>
<version>${jta.version}</version>
</dependency>
<!-- testing --> <!-- testing -->
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
Expand Down Expand Up @@ -576,12 +567,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>


<dependency>
<groupId>geronimo-spec</groupId>
<artifactId>geronimo-spec-j2ee</artifactId>
<version>1.4-rc4</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.hsqldb</groupId> <groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId> <artifactId>hsqldb</artifactId>
Expand Down

0 comments on commit ed44cc8

Please sign in to comment.