Package org.neo4j.kernel.impl.transaction.xaframework

Examples of org.neo4j.kernel.impl.transaction.xaframework.XaDataSource


    protected StoreId getMyStoreId()
    {
        if ( myStoreId == null )
        {
            XaDataSource ds = ((AbstractGraphDatabase) graphDb).getConfig().getTxModule()
                    .getXaDataSourceManager().getXaDataSource( Config.DEFAULT_DATA_SOURCE_NAME );
            myStoreId = ((NeoStoreXaDataSource) ds).getStoreId();
        }
        return myStoreId;
    }
View Full Code Here


        @Override
        public void run()
        {
            String provider = config.get( KEY_INDEX_PROVIDER );
            String dataSourceName = getIndexProvider( provider ).getDataSourceName();
            XaDataSource dataSource = graphDbImpl.getConfig().getTxModule().getXaDataSourceManager().getXaDataSource( dataSourceName );
            IndexXaConnection connection = (IndexXaConnection) dataSource.getXaConnection();
            Transaction tx = graphDbImpl.beginTx();
            try
            {
                javax.transaction.Transaction javaxTx = graphDbImpl.getConfig().getTxModule().getTxManager().getTransaction();
                javaxTx.enlistResource( connection.getXaResource() );
View Full Code Here

        Map<Object,Object> config = new HashMap<Object,Object>();
        config.put( "store_dir", "target/var" );
        config.put( LogBufferFactory.class, CommonFactories.defaultLogBufferFactory( config ) );
        xaDsMgr.registerDataSource( "dummy_datasource", new DummyXaDataSource(
                config ), UTF8.encode( "DDDDDD" ) );
        XaDataSource xaDs = xaDsMgr.getXaDataSource( "dummy_datasource" );
        DummyXaConnection xaC = null;
        try
        {
            xaC = (DummyXaConnection) xaDs.getXaConnection();
            try
            {
                xaC.doStuff1();
                fail( "Non enlisted resource should throw exception" );
            }
View Full Code Here

            RuntimeException cause = new RuntimeException( "Unable to get master from ZK" );
            shutdown( cause, false );
            throw cause;
        }

        XaDataSource nioneoDataSource = getConfig().getTxModule()
                .getXaDataSourceManager().getXaDataSource( Config.DEFAULT_DATA_SOURCE_NAME );
        long myLastCommittedTx = nioneoDataSource.getLastCommittedTxId();
        long highestCommonTxId = Math.min( myLastCommittedTx, master.other().getLastCommittedTxId() );
        int masterForMyHighestCommonTxId = -1;
        try
        {
            masterForMyHighestCommonTxId = nioneoDataSource.getMasterForCommittedTx( highestCommonTxId );;
        }
        catch ( IOException e )
        {
            // This is quite dangerous to just catch here... but the special case is
            // where this db was just now copied from the master where there's data,
View Full Code Here

            throw new TransactionFailureException( "Data source[" + name
                + "] has already been registered" );
        }
        try
        {
            XaDataSource dataSource = xaDsMgr.create( className, params );
            xaDsMgr.registerDataSource( name, dataSource, resourceId );
            return dataSource;
        }
        catch ( Exception e )
        {
View Full Code Here

            throw new TransactionFailureException( "Data source[" + name
                + "] has already been registered" );
        }
        try
        {
            XaDataSource dataSource = xaDsMgr.create( className, params );
            xaDsMgr.registerDataSource( name, dataSource, resourceId );
            return dataSource;
        }
        catch ( Exception e )
        {
View Full Code Here

    /**
     * Public for testing purpose. Do not use.
     */
    public synchronized void unregisterDataSource( String name )
    {
        XaDataSource dataSource = dataSources.get( name );
        byte branchId[] = getBranchId(
            dataSource.getXaConnection().getXaResource() );
        dataSources.remove( name );
        branchIdMapping.remove( UTF8.decode( branchId ) );
        sourceIdMapping.remove( name );
        dataSource.close();
    }
View Full Code Here

        branchIdMapping.clear();
        sourceIdMapping.clear();
        Iterator<XaDataSource> itr = dataSources.values().iterator();
        while ( itr.hasNext() )
        {
            XaDataSource dataSource = itr.next();
            dataSource.close();
        }
        dataSources.clear();
    }
View Full Code Here

        Iterator<Map.Entry<String,XaDataSource>> itr =
            dataSources.entrySet().iterator();
        while ( itr.hasNext() )
        {
            Map.Entry<String,XaDataSource> entry = itr.next();
            XaDataSource dataSource = entry.getValue();
            XAResource resource = dataSource.getXaConnection().getXaResource();
            try
            {
                if ( resource.isSameRM( xaResource ) )
                {
                    String name = entry.getKey();
View Full Code Here

            "Unable to find mapping for XAResource[" + xaResource + "]" );
    }

    synchronized XAResource getXaResource( byte branchId[] )
    {
        XaDataSource dataSource = branchIdMapping.get( UTF8.decode( branchId ) );
        if ( dataSource == null )
        {
            throw new TransactionFailureException(
                "No mapping found for branchId[0x" +
                UTF8.decode( branchId ) + "]" );
        }
        return dataSource.getXaConnection().getXaResource();
    }
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.impl.transaction.xaframework.XaDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.