mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 07:35:24 +02:00
[227406][api][dstore] need apis for getting buffer size in IDataStoreProvider
This commit is contained in:
parent
cc235ba048
commit
04570d74c6
9 changed files with 90 additions and 40 deletions
|
@ -33,7 +33,7 @@ import org.eclipse.dstore.core.model.ISchemaExtender;
|
|||
import org.eclipse.dstore.core.server.SystemServiceManager;
|
||||
|
||||
/**
|
||||
* Miner is the abstact base class of all DataStore extensions).
|
||||
* Miner is the abstract base class of all DataStore extensions).
|
||||
* The DataStore framework knows how to load and route commands to miners
|
||||
* because it interfaces miners through the restricted set of interfaces declared here.
|
||||
* To add a new miner, developers must extend this class and implement the abstract methods declared here.
|
||||
|
@ -42,8 +42,6 @@ public abstract class Miner extends Handler
|
|||
implements ISchemaExtender
|
||||
{
|
||||
|
||||
|
||||
public DataStore _dataStore;
|
||||
public DataElement _minerElement;
|
||||
public DataElement _minerData;
|
||||
public DataElement _minerTransient;
|
||||
|
@ -203,8 +201,16 @@ implements ISchemaExtender
|
|||
{
|
||||
while (!_commandQueue.isEmpty())
|
||||
{
|
||||
DataElement cmd = (DataElement)_commandQueue.remove(0);
|
||||
command(cmd);
|
||||
try
|
||||
{
|
||||
DataElement cmd = (DataElement)_commandQueue.remove(0);
|
||||
if (cmd != null){
|
||||
command(cmd);
|
||||
}
|
||||
}
|
||||
catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
waitForInput();
|
||||
}
|
||||
|
@ -257,7 +263,7 @@ implements ISchemaExtender
|
|||
* @return the status of the command
|
||||
*/
|
||||
protected final DataElement command(DataElement command)
|
||||
{
|
||||
{
|
||||
String name = getCommandName(command);
|
||||
DataElement status = getCommandStatus(command);
|
||||
|
||||
|
|
|
@ -11,12 +11,30 @@
|
|||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
* David McKnight (IBM) - [227406][api][dstore] need apis for getting buffer size in IDataStoreProvider
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.dstore.core.model;
|
||||
|
||||
|
||||
public interface IDataStoreProvider
|
||||
{
|
||||
public DataStore getDataStore();
|
||||
|
||||
/**
|
||||
* Returns the upload buffer size preference. To be used by Dstore
|
||||
* services to determine buffer size when uploading.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public int getBufferUploadSize();
|
||||
|
||||
/**
|
||||
* Returns the download buffer size preference. To be used by
|
||||
* Dstore services to determine buffer size when downloading.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public int getBufferDownloadSize();
|
||||
|
||||
}
|
|
@ -60,10 +60,15 @@ public class Sender implements ISender
|
|||
_xmlGenerator = new XMLgenerator(_dataStore);
|
||||
try
|
||||
{
|
||||
int bufferSize = _socket.getSendBufferSize();
|
||||
int bufferSize = _socket.getSendBufferSize() * 4;
|
||||
System.out.println("buffer size = "+bufferSize);
|
||||
|
||||
_socket.setSendBufferSize(bufferSize);
|
||||
_xmlGenerator.setBufferSize(bufferSize);
|
||||
|
||||
int rbufferSize = _socket.getReceiveBufferSize() * 4;
|
||||
System.out.println("rbuffer size = "+rbufferSize);
|
||||
_socket.setReceiveBufferSize(rbufferSize);
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
|
|
|
@ -167,7 +167,7 @@ public class XMLparser
|
|||
*/
|
||||
public void readFile(BufferedInputStream reader, int size, String path, String byteStreamHandlerId)
|
||||
{
|
||||
|
||||
/*
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
//long totalMem = rt.totalMemory();
|
||||
long freeMem = rt.freeMemory();
|
||||
|
@ -176,7 +176,7 @@ public class XMLparser
|
|||
{
|
||||
rt.gc();
|
||||
}
|
||||
|
||||
*/
|
||||
if (_fileByteBuffer == null || _fileByteBuffer.length < size)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
org.eclipse.dstore.core;bundle-version="[3.0.0,4.0.0)",
|
||||
org.eclipse.dstore.extra;bundle-version="[2.1.0,3.0.0)",
|
||||
org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
|
||||
org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)"
|
||||
org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
|
||||
org.eclipse.rse.subsystems.files.core;bundle-version="3.0.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-LazyStart: true
|
||||
Export-Package:
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* David McKnight (IBM) - [220123] [api][dstore] Configurable timeout on irresponsiveness
|
||||
* David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
|
||||
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
|
||||
* David McKnight (IBM) - [227406][api][dstore] need apis for getting buffer size in IDataStoreProvider
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.connectorservice.dstore;
|
||||
|
@ -81,6 +82,7 @@ import org.eclipse.rse.internal.connectorservice.dstore.Activator;
|
|||
import org.eclipse.rse.internal.connectorservice.dstore.ConnectorServiceResources;
|
||||
import org.eclipse.rse.internal.connectorservice.dstore.IConnectorServiceMessageIds;
|
||||
import org.eclipse.rse.internal.connectorservice.dstore.RexecDstoreServer;
|
||||
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
||||
import org.eclipse.rse.internal.ui.SystemPropertyResources;
|
||||
import org.eclipse.rse.services.clientserver.messages.CommonMessages;
|
||||
import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds;
|
||||
|
@ -1457,6 +1459,27 @@ public class DStoreConnectorService extends StandardConnectorService implements
|
|||
|
||||
protected SystemMessage createSystemMessage(String msgId, int severity, String msg, String msgDetails) {
|
||||
return new SimpleSystemMessage(Activator.PLUGIN_ID, msgId, severity, msg, msgDetails);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getBufferUploadSize()
|
||||
{
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
|
||||
int value = store.getInt(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE) * IUniversalDataStoreConstants.KB_IN_BYTES;
|
||||
if (value == 0)
|
||||
value = IUniversalDataStoreConstants.BUFFER_SIZE;
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
public int getBufferDownloadSize()
|
||||
{
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
int value = store.getInt(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE) * IUniversalDataStoreConstants.KB_IN_BYTES;
|
||||
if (value == 0)
|
||||
value = IUniversalDataStoreConstants.BUFFER_SIZE;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
* David McKnight (IBM) - [220379] [api] Provide a means for contributing custom BIDI encodings
|
||||
* David McKnight (IBM) - [225573] [dstore] client not falling back to single operation when missing batch descriptors (due to old server)
|
||||
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
|
||||
* David McKnight (IBM) - [227406][api][dstore] need apis for getting buffer size in IDataStoreProvider
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.services.dstore.files;
|
||||
|
@ -105,9 +106,6 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
protected org.eclipse.dstore.core.model.DataElement _uploadLogElement = null;
|
||||
protected Map _fileElementMap;
|
||||
protected Map _dstoreFileMap;
|
||||
|
||||
private int _bufferUploadSize = IUniversalDataStoreConstants.BUFFER_SIZE;
|
||||
private int _bufferDownloadSize = IUniversalDataStoreConstants.BUFFER_SIZE;
|
||||
protected ISystemFileTypes _fileTypeRegistry;
|
||||
private String remoteEncoding;
|
||||
|
||||
|
@ -150,24 +148,34 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
return ServiceResources.DStore_File_Service_Description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the buffer upload size
|
||||
* @param size the new size
|
||||
*
|
||||
* @deprecated no longer used - instead using the IDataStoreProvider
|
||||
*/
|
||||
public void setBufferUploadSize(int size)
|
||||
{
|
||||
_bufferUploadSize = size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the buffer download size
|
||||
* @param size the new size
|
||||
*
|
||||
* @deprecated no longer used - instead using the IDataStoreProvider
|
||||
*/
|
||||
public void setBufferDownloadSize(int size)
|
||||
{
|
||||
_bufferDownloadSize = size;
|
||||
}
|
||||
|
||||
protected int getBufferUploadSize()
|
||||
{
|
||||
return _bufferUploadSize;
|
||||
return _dataStoreProvider.getBufferUploadSize();
|
||||
}
|
||||
|
||||
protected int getBufferDownloadSize()
|
||||
{
|
||||
return _bufferDownloadSize;
|
||||
{
|
||||
return _dataStoreProvider.getBufferDownloadSize();
|
||||
}
|
||||
|
||||
protected String getMinerId()
|
||||
|
@ -702,7 +710,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
argList.add(bufferSizeElement);
|
||||
|
||||
DataElement subject = ds.createObject(universaltemp, de.getType(), remotePath, String.valueOf(mode));
|
||||
|
||||
long t1 = System.currentTimeMillis();
|
||||
DataElement status = ds.command(queryCmd, argList, subject);
|
||||
if (status == null)
|
||||
{
|
||||
|
@ -735,6 +743,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
|||
return false;
|
||||
}
|
||||
|
||||
long t2 = System.currentTimeMillis();
|
||||
System.out.println("time="+(t2 - t1)/1000);
|
||||
// now wait till we have all the bytes local
|
||||
long localBytes = localFile.length();
|
||||
long lastLocalBytes = 0;
|
||||
|
|
|
@ -354,10 +354,11 @@ public class DStoreHostFile implements IHostFile, IHostFilePermissionsContainer
|
|||
{
|
||||
if (attributes != null)
|
||||
{
|
||||
String[] str = attributes.split("\\"+IServiceConstants.TOKEN_SEPARATOR); //$NON-NLS-1$
|
||||
if (str.length > index)
|
||||
{
|
||||
return str[index];
|
||||
synchronized (attributes){
|
||||
String[] str = attributes.split("\\"+IServiceConstants.TOKEN_SEPARATOR); //$NON-NLS-1$
|
||||
if (str.length > index){
|
||||
return str[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -16,20 +16,18 @@
|
|||
* Kushal Munir (IBM) - [189352] Set whether file service is Unix-style system or not
|
||||
* David McKnight (IBM) - [206755] upload and download buffer should be in kbytes, not bytes
|
||||
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
||||
* David McKnight (IBM) - [227406][api][dstore] need apis for getting buffer size in IDataStoreProvider
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.subsystems.files.dstore;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.rse.connectorservice.dstore.DStoreConnectorService;
|
||||
import org.eclipse.rse.connectorservice.dstore.DStoreConnectorServiceManager;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
|
||||
import org.eclipse.rse.internal.services.dstore.files.DStoreFileService;
|
||||
import org.eclipse.rse.internal.services.dstore.search.DStoreSearchService;
|
||||
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
||||
import org.eclipse.rse.internal.subsystems.files.dstore.DStoreFileAdapter;
|
||||
import org.eclipse.rse.internal.subsystems.files.dstore.DStoreFileSubSystemSearchResultConfiguration;
|
||||
import org.eclipse.rse.internal.subsystems.files.dstore.DStoreLanguageUtilityFactory;
|
||||
|
@ -45,7 +43,6 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSyst
|
|||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystemConfiguration;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
||||
public class DStoreFileSubSystemConfiguration extends FileServiceSubSystemConfiguration
|
||||
{
|
||||
|
@ -135,17 +132,6 @@ public class DStoreFileSubSystemConfiguration extends FileServiceSubSystemConfig
|
|||
DStoreFileService service = new DStoreFileService(connectorService, RemoteFileUtility.getSystemFileTransferModeRegistry());
|
||||
service.setIsUnixStyle(isUnixStyle());
|
||||
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
int downloadBufferSize = store.getInt(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE) * IUniversalDataStoreConstants.KB_IN_BYTES;
|
||||
int uploadBufferSize = store.getInt(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE) * IUniversalDataStoreConstants.KB_IN_BYTES;
|
||||
if (downloadBufferSize > 0)
|
||||
{
|
||||
service.setBufferDownloadSize(downloadBufferSize);
|
||||
}
|
||||
if (uploadBufferSize > 0)
|
||||
{
|
||||
service.setBufferUploadSize(uploadBufferSize);
|
||||
}
|
||||
return service;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue