Skip to content

Commit

Permalink
BZ-1192459: more cleanup on sync; now double checked with cluster setup
Browse files Browse the repository at this point in the history
  • Loading branch information
porcelli committed Feb 20, 2015
1 parent 42fed0f commit eba8054
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
Expand Up @@ -60,6 +60,7 @@
import org.uberfire.ext.editor.commons.service.DeleteService;
import org.uberfire.io.IOService;
import org.uberfire.java.nio.base.options.CommentedOption;
import org.uberfire.java.nio.file.FileSystem;
import org.uberfire.java.nio.file.Files;
import org.uberfire.java.nio.file.StandardDeleteOption;
import org.uberfire.rpc.SessionInfo;
Expand All @@ -83,6 +84,10 @@ public class ExplorerServiceImpl
@Named("configIO")
private IOService ioServiceConfig;

@Inject
@Named("systemFS")
private FileSystem fileSystem;

@Inject
private KieProjectService projectService;

Expand Down Expand Up @@ -436,33 +441,28 @@ private synchronized void cleanup( final Project project ) {
final Collection<org.uberfire.java.nio.file.Path> lastNavs = userServicesBackend.getAllUsersData( "explorer", "last.user.nav" );
final Collection<org.uberfire.java.nio.file.Path> userNavs = userServicesBackend.getAllUsersData( "explorer", "user.nav" );

for ( org.uberfire.java.nio.file.Path path : userNavs ) {
final UserExplorerData userContent = helper.loadUserContent( path );
if ( userContent != null ) {
if ( userContent.deleteProject( project ) ) {
try {
ioServiceConfig.startBatch( path.getFileSystem() );
try {
ioServiceConfig.startBatch( fileSystem );

for ( org.uberfire.java.nio.file.Path path : userNavs ) {
final UserExplorerData userContent = helper.loadUserContent( path );
if ( userContent != null ) {
if ( userContent.deleteProject( project ) ) {
ioServiceConfig.write( path, xs.toXML( userContent ) );
} finally {
ioServiceConfig.endBatch();
}
}
}
}

for ( org.uberfire.java.nio.file.Path lastNav : lastNavs ) {
final UserExplorerLastData lastUserContent = helper.getLastContent( lastNav );
if ( lastUserContent != null ) {
if ( lastUserContent.deleteProject( project ) ) {
try {
ioServiceConfig.startBatch( lastNav.getFileSystem() );
for ( org.uberfire.java.nio.file.Path lastNav : lastNavs ) {
final UserExplorerLastData lastUserContent = helper.getLastContent( lastNav );
if ( lastUserContent != null ) {
if ( lastUserContent.deleteProject( project ) ) {
ioServiceConfig.write( lastNav, xs.toXML( lastUserContent ) );
} finally {
ioServiceConfig.endBatch();
}
}
}

} finally {
ioServiceConfig.endBatch();
}
}

Expand Down
Expand Up @@ -80,7 +80,7 @@ public ProjectExplorerContentResolver( final KieProjectService projectService,
this.organizationalUnitService = organizationalUnitService;
}

public synchronized ProjectExplorerContent resolve( final ProjectExplorerContentQuery query ) {
public ProjectExplorerContent resolve( final ProjectExplorerContentQuery query ) {

final Content content = setupSelectedItems( query );

Expand Down
Expand Up @@ -39,7 +39,7 @@ public boolean exists( final ServerRef serverRef ) {
return ioService.exists( buildPath( serverRef ) );
}

public synchronized void forceRegister( final ServerRef serverRef ) {
public void forceRegister( final ServerRef serverRef ) {
final Path path = buildPath( serverRef );
try {
ioService.startBatch( path.getFileSystem() );
Expand All @@ -49,7 +49,7 @@ public synchronized void forceRegister( final ServerRef serverRef ) {
}
}

public synchronized void register( final ServerRef serverRef ) {
public void register( final ServerRef serverRef ) {
if ( !exists( serverRef ) ) {
final Path path = buildPath( serverRef );
try {
Expand All @@ -63,7 +63,7 @@ public synchronized void register( final ServerRef serverRef ) {
}
}

public synchronized Collection<ServerRef> listRegisteredServers() {
public Collection<ServerRef> listRegisteredServers() {
final Collection<ServerRef> result = new ArrayList<ServerRef>();
final Path dir = buildPath( (String) null );

Expand Down Expand Up @@ -93,7 +93,7 @@ private ServerRef restoreConfig( final Path registeredServer ) {
return null;
}

public synchronized void unregister( final ServerRef serverRef ) {
public void unregister( final ServerRef serverRef ) {
final Path path = buildPath( serverRef );

try {
Expand Down Expand Up @@ -123,7 +123,7 @@ public String toHex( final String arg ) {
return String.format( "%x", new BigInteger( 1, arg.toLowerCase().getBytes( Charset.forName( "UTF-8" ) ) ) );
}

public synchronized void createContainer( final ContainerRef containerRef ) {
public void createContainer( final ContainerRef containerRef ) {
final Path path = buildPath( containerRef.getServerId() );
try {
ioService.startBatch( path.getFileSystem() );
Expand All @@ -145,8 +145,8 @@ public ServerRef loadServerRef( String serverId ) {
return restoreConfig( path );
}

public synchronized void deleteContainer( String serverId,
String containerId ) {
public void deleteContainer( String serverId,
String containerId ) {
final Path path = buildPath( serverId );
final ServerRef serverRef = loadServerRef( serverId );
if ( serverRef != null ) {
Expand All @@ -161,9 +161,9 @@ public synchronized void deleteContainer( String serverId,

}

public synchronized void updateContainer( String serverId,
String containerId,
GAV releaseId ) {
public void updateContainer( String serverId,
String containerId,
GAV releaseId ) {
final Path path = buildPath( serverId );
final ServerRef serverRef = loadServerRef( serverId );
if ( serverRef != null ) {
Expand All @@ -184,9 +184,9 @@ public synchronized void updateContainer( String serverId,
}
}

public synchronized void updateContainer( String serverId,
String containerId,
Long pollInterval ) {
public void updateContainer( String serverId,
String containerId,
Long pollInterval ) {
final Path path = buildPath( serverId );
final ServerRef serverRef = loadServerRef( serverId );
if ( serverRef != null ) {
Expand Down

0 comments on commit eba8054

Please sign in to comment.