mirror of https://github.com/apache/activemq.git
AMQ-2052 Be careful about when to use a file-system-safened id
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@730596 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e08cc350e0
commit
13d692ebde
|
@ -21,6 +21,8 @@ import java.io.IOException;
|
|||
import java.io.ObjectInput;
|
||||
import java.io.ObjectOutput;
|
||||
|
||||
import org.apache.activemq.util.IOHelper;
|
||||
|
||||
/**
|
||||
* Used by RootContainers
|
||||
*
|
||||
|
@ -46,13 +48,6 @@ public class ContainerId implements Externalizable {
|
|||
return dataContainerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataContainerName The dataContainerPrefix to set.
|
||||
*/
|
||||
public void setDataContainerName(String dataContainerName) {
|
||||
this.dataContainerName = dataContainerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the key.
|
||||
*/
|
||||
|
@ -60,13 +55,6 @@ public class ContainerId implements Externalizable {
|
|||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key The key to set.
|
||||
*/
|
||||
public void setKey(Object key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return key.hashCode() ^ dataContainerName.hashCode();
|
||||
}
|
||||
|
@ -92,4 +80,8 @@ public class ContainerId implements Externalizable {
|
|||
public String toString() {
|
||||
return "CID{" + dataContainerName + ":" + key + "}";
|
||||
}
|
||||
|
||||
public String getFileSystemSafeContainerName() {
|
||||
return IOHelper.toFileSystemSafeName(dataContainerName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,9 +198,7 @@ public class KahaStore implements Store {
|
|||
|
||||
public synchronized boolean doesMapContainerExist(Object id, String containerName) throws IOException {
|
||||
initialize();
|
||||
ContainerId containerId = new ContainerId();
|
||||
containerId.setKey(id);
|
||||
containerId.setDataContainerName(containerName);
|
||||
ContainerId containerId = new ContainerId(id, containerName);
|
||||
return maps.containsKey(containerId) || mapsContainer.doesRootExist(containerId);
|
||||
}
|
||||
|
||||
|
@ -212,17 +210,16 @@ public class KahaStore implements Store {
|
|||
return getMapContainer(id, containerName, persistentIndex);
|
||||
}
|
||||
|
||||
public synchronized MapContainer getMapContainer(Object id, String originalContainerName, boolean persistentIndex)
|
||||
public synchronized MapContainer getMapContainer(Object id, String containerName, boolean persistentIndex)
|
||||
throws IOException {
|
||||
initialize();
|
||||
String containerName = IOHelper.toFileSystemSafeName(originalContainerName);
|
||||
ContainerId containerId = new ContainerId();
|
||||
containerId.setKey(id);
|
||||
containerId.setDataContainerName(containerName);
|
||||
ContainerId containerId = new ContainerId(id, containerName);
|
||||
MapContainerImpl result = maps.get(containerId);
|
||||
if (result == null) {
|
||||
DataManager dm = getDataManager(containerName);
|
||||
IndexManager im = getIndexManager(dm, containerName);
|
||||
String fileSystemSafeContainerName = containerId.getFileSystemSafeContainerName();
|
||||
DataManager dm = getDataManager(fileSystemSafeContainerName);
|
||||
IndexManager im = getIndexManager(dm, fileSystemSafeContainerName);
|
||||
|
||||
IndexItem root = mapsContainer.getRoot(im, containerId);
|
||||
if (root == null) {
|
||||
root = mapsContainer.addRoot(im, containerId);
|
||||
|
@ -268,9 +265,7 @@ public class KahaStore implements Store {
|
|||
|
||||
public synchronized boolean doesListContainerExist(Object id, String containerName) throws IOException {
|
||||
initialize();
|
||||
ContainerId containerId = new ContainerId();
|
||||
containerId.setKey(id);
|
||||
containerId.setDataContainerName(containerName);
|
||||
ContainerId containerId = new ContainerId(id, containerName);
|
||||
return lists.containsKey(containerId) || listsContainer.doesRootExist(containerId);
|
||||
}
|
||||
|
||||
|
@ -282,17 +277,15 @@ public class KahaStore implements Store {
|
|||
return getListContainer(id, containerName, persistentIndex);
|
||||
}
|
||||
|
||||
public synchronized ListContainer getListContainer(Object id, String originalContainerName,
|
||||
public synchronized ListContainer getListContainer(Object id, String containerName,
|
||||
boolean persistentIndex) throws IOException {
|
||||
initialize();
|
||||
String containerName = IOHelper.toFileSystemSafeName(originalContainerName);
|
||||
ContainerId containerId = new ContainerId();
|
||||
containerId.setKey(id);
|
||||
containerId.setDataContainerName(containerName);
|
||||
ContainerId containerId = new ContainerId(id, containerName);
|
||||
ListContainerImpl result = lists.get(containerId);
|
||||
if (result == null) {
|
||||
DataManager dm = getDataManager(containerName);
|
||||
IndexManager im = getIndexManager(dm, containerName);
|
||||
String fileSystemSafeContainerName = containerId.getFileSystemSafeContainerName();
|
||||
DataManager dm = getDataManager(fileSystemSafeContainerName);
|
||||
IndexManager im = getIndexManager(dm, fileSystemSafeContainerName);
|
||||
|
||||
IndexItem root = listsContainer.getRoot(im, containerId);
|
||||
if (root == null) {
|
||||
|
|
Loading…
Reference in New Issue