mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Point checkin that suppresses spurious Cycle exception.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3530 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -13,6 +13,9 @@
|
|||||||
<property name="serviceInterface">
|
<property name="serviceInterface">
|
||||||
<value>org.alfresco.repo.avm.AVMRemote</value>
|
<value>org.alfresco.repo.avm.AVMRemote</value>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="refreshStubOnConnectFailure">
|
||||||
|
<value>true</value>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -20,6 +20,7 @@ package org.alfresco.repo.avm;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -147,7 +148,6 @@ public class AVMRemoteImpl implements AVMRemote, Runnable
|
|||||||
{
|
{
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
List<String> toClose = new ArrayList<String>();
|
List<String> toClose = new ArrayList<String>();
|
||||||
for (String handle : fInputLastAccessTimes.keySet())
|
for (String handle : fInputLastAccessTimes.keySet())
|
||||||
@@ -201,7 +201,6 @@ public class AVMRemoteImpl implements AVMRemote, Runnable
|
|||||||
fOutputLastAccessTimes.remove(handle);
|
fOutputLastAccessTimes.remove(handle);
|
||||||
fOutputBusy.remove(handle);
|
fOutputBusy.remove(handle);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,18 +264,17 @@ public class AVMRemoteImpl implements AVMRemote, Runnable
|
|||||||
fInputLastAccessTimes.put(handle, System.currentTimeMillis());
|
fInputLastAccessTimes.put(handle, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
byte [] buff = new byte[count];
|
byte [] buff = new byte[count];
|
||||||
int off = 0;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int read;
|
int read = in.read(buff);
|
||||||
while ((read = in.read(buff, off, count - off)) != -1 && read != 0)
|
if (read == -1)
|
||||||
{
|
{
|
||||||
off += read;
|
read = 0;
|
||||||
}
|
}
|
||||||
if (off != count)
|
if (read != count)
|
||||||
{
|
{
|
||||||
byte [] newBuff = new byte[off];
|
byte [] newBuff = new byte[read];
|
||||||
for (int i = 0; i < off; i++)
|
for (int i = 0; i < read; i++)
|
||||||
{
|
{
|
||||||
newBuff[i] = buff[i];
|
newBuff[i] = buff[i];
|
||||||
}
|
}
|
||||||
|
@@ -729,7 +729,7 @@ class AVMRepository
|
|||||||
}
|
}
|
||||||
if (fLookupCount.get() > 50)
|
if (fLookupCount.get() > 50)
|
||||||
{
|
{
|
||||||
throw new AVMCycleException("Cycle in lookup.");
|
// throw new AVMCycleException("Cycle in lookup.");
|
||||||
}
|
}
|
||||||
String [] pathParts = SplitPath(path);
|
String [] pathParts = SplitPath(path);
|
||||||
AVMStore store = getAVMStoreByName(pathParts[0]);
|
AVMStore store = getAVMStoreByName(pathParts[0]);
|
||||||
@@ -789,10 +789,18 @@ class AVMRepository
|
|||||||
*/
|
*/
|
||||||
public Lookup lookupDirectory(int version, String path)
|
public Lookup lookupDirectory(int version, String path)
|
||||||
{
|
{
|
||||||
fLookupCount.set(fLookupCount.get() + 1);
|
Integer count = fLookupCount.get();
|
||||||
|
if (count == null)
|
||||||
|
{
|
||||||
|
fLookupCount.set(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fLookupCount.set(count + 1);
|
||||||
|
}
|
||||||
if (fLookupCount.get() > 50)
|
if (fLookupCount.get() > 50)
|
||||||
{
|
{
|
||||||
throw new AVMCycleException("Cycle in lookup.");
|
// throw new AVMCycleException("Cycle in lookup.");
|
||||||
}
|
}
|
||||||
String [] pathParts = SplitPath(path);
|
String [] pathParts = SplitPath(path);
|
||||||
AVMStore store = getAVMStoreByName(pathParts[0]);
|
AVMStore store = getAVMStoreByName(pathParts[0]);
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.alfresco.repo.avm;
|
package org.alfresco.repo.avm;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.context.support.FileSystemXmlApplicationContext;
|
import org.springframework.context.support.FileSystemXmlApplicationContext;
|
||||||
@@ -104,6 +103,34 @@ public class AVMTestRemote extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Another test of reading.
|
||||||
|
*/
|
||||||
|
public void testRead()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Create a file.
|
||||||
|
byte [] buff = new byte[64];
|
||||||
|
for (int i = 0; i < 64; i++)
|
||||||
|
{
|
||||||
|
buff[i] = (byte)i;
|
||||||
|
}
|
||||||
|
String outHandle = fAVMRemote.createFile("main:/", "foo.dat");
|
||||||
|
fAVMRemote.writeOutput(outHandle, buff, 64);
|
||||||
|
fAVMRemote.closeOutputHandle(outHandle);
|
||||||
|
// Read it back in.
|
||||||
|
String inHandle = fAVMRemote.getInputHandle(-1, "main:/foo.dat");
|
||||||
|
buff = fAVMRemote.readInput(inHandle, 64);
|
||||||
|
fAVMRemote.closeInputHandle(inHandle);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test a call that should throw an exception.
|
* Test a call that should throw an exception.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user