当前位置: 首页>>代码示例>>Java>>正文


Java Document.recycle方法代码示例

本文整理汇总了Java中lotus.domino.Document.recycle方法的典型用法代码示例。如果您正苦于以下问题:Java Document.recycle方法的具体用法?Java Document.recycle怎么用?Java Document.recycle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lotus.domino.Document的用法示例。


在下文中一共展示了Document.recycle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteDocument

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
public void deleteDocument(String id) throws ServiceException {
    checkNoDocument();
    try {
        // Should use both UNID and ID....
        Document ddoc = database.getDocumentByUNID(id);
        if(ddoc!=null) {
            try { 
                ddoc.remove(true);
                
                if( Loggers.SERVICES_LOGGER.isTraceDebugEnabled() ){
                    Loggers.SERVICES_LOGGER.traceDebugp(this, "deleteDocument", // $NON-NLS-1$
                            "Document #{0} deleted",id); // $NON-NLS-1$
                }
            } finally {
                ddoc.recycle();
            }
        } else {
            throw new ServiceException(null,"The document with id {0} cannot be found",id);  // $NLX-RestDocumentNavigatorFactory.Errorwhilecreatingaloadingdocumen.1-1$
        }
    } catch(NotesException ex) {
        throw new ServiceException(ex,"An error occurred while deleting document with id {0}",id);  // $NLX-RestDocumentNavigatorFactory.Errorwhilecreatingadeletingdocume-1$
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:25,代码来源:RestDocumentNavigatorFactory.java

示例2: createSampleDbDirProfile

import lotus.domino.Document; //导入方法依赖的package包/类
private void createSampleDbDirProfile(Database db) throws NotesException {
	Document docProfile = db.getProfileDocument("DirectoryProfile", null);
	docProfile.replaceItemValue("Form", "DirectoryProfile");
	docProfile.replaceItemValue("Domain", db.getParent().evaluate("@Domain", docProfile));
	docProfile.replaceItemValue("GroupSortDefault", "1");
	docProfile.replaceItemValue("AutoPopulateMembersInterval", "30");
	docProfile.replaceItemValue("SecureInetPasswords", "1");
	docProfile.replaceItemValue("AltLanguageInfoAllowed", "1");
	docProfile.computeWithForm(false, false);
	docProfile.save(true, false);
	docProfile.recycle();
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:13,代码来源:BaseJNATestClass.java

示例3: buildDirectMessages

import lotus.domino.Document; //导入方法依赖的package包/类
/**
 * Builds the direct messages.
 *
 * @param doc the doc
 */
@Stopwatch
private void buildDirectMessages(Document doc) {
	Document directMessage=null;
	try{
		for(String server : this.getClusterMates(doc.getParentDatabase().getParent())){
			directMessage = doc.copyToDatabase(doc.getParentDatabase());
			directMessage.replaceItemValue(Const.FIELD_TO, server);
			directMessage.save();
			directMessage.recycle();
		}
	}catch(Exception e){
		LOG.log(Level.SEVERE,null, e);

		try {
			doc.replaceItemValue(Const.FIELD_ERROR, e.getLocalizedMessage());
			doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_ERROR);
			doc.save();

			directMessage.replaceItemValue(Const.FIELD_ERROR, e.getLocalizedMessage());
			directMessage.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_ERROR);
			directMessage.save();

		} catch (NotesException e1) {
			LOG.log(Level.SEVERE,null, e);
		}


	}


}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:37,代码来源:BroadcastQueueProcessor.java

示例4: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {
	
	if(TaskRunner.getInstance().isClosing()){
		return;
	}
	
	//exit if nobody on.
	if(server.getWebSocketCount() == 0) return;
	
	Session session = this.openSession();
	try {
		Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
		View view = db.getView(this.getEventQueue());
		view.setAutoUpdate(false);
		DocumentCollection col = view.getAllDocumentsByKey(target, true);
		Document doc = col.getFirstDocument();
		Document temp = null;
		while(doc!=null){
			if(doc.isValid()){
				this.processDoc(doc);
			}
			temp = col.getNextDocument(doc);
			doc.recycle();
			doc = temp;
		}

		view.setAutoUpdate(true);
	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);

	}finally{
		this.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:37,代码来源:EventQueueProcessor.java

示例5: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {

	if(TaskRunner.getInstance().isClosing()){
		return;
	}
	
	if(server.getWebSocketAndObserverCount() == 0)return;

	Session session = this.openSession();
	try {
		Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
		View view = db.getView(Const.VIEW_MSG_QUEUE);
		if(view.getAllEntries().getCount() > 0){
			view.setAutoUpdate(false);
			Document doc = view.getFirstDocument();
			Document temp = null;
			while(doc!=null){
				if(doc.isValid() && !doc.hasItem(StringCache.FIELD_CONFLICT)){
					this.processDoc(doc);

				}else if(doc.isValid() && doc.hasItem(StringCache.FIELD_CONFLICT)){
					this.processConflict(doc);
				}
				temp = view.getNextDocument(doc);
				doc.recycle();
				doc = temp;	
			}

			view.setAutoUpdate(true);
		}
	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);

	}finally{
		this.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:40,代码来源:QueueProcessor.java

示例6: setClustermateUsersOffline

import lotus.domino.Document; //导入方法依赖的package包/类
/**
 * Sets the clustermate users offline.
 *
 * @param db the db
 * @param clustermate the clustermate
 */
@Stopwatch
private void setClustermateUsersOffline(Database db, String clustermate) {

	try {
		View view = db.getView(Const.VIEW_USERS);
		view.setAutoUpdate(false);
		Document doc = view.getFirstDocument();
		Document temp = null;
		while(doc!=null){

			if(doc.isValid()){
				String host = doc.getItemValueString(Const.FIELD_HOST);

				//if hosts are the same
				if(host!=null && host.equals(clustermate)){
					doc.replaceItemValue(Const.FIELD_STATUS, Const.STATUS_OFFLINE);
					doc.save();
				}
			}

			temp = view.getNextDocument(doc);
			doc.recycle();
			doc = temp;
		}
		view.setAutoUpdate(true);

	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);
	}

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:38,代码来源:ClustermateMonitor.java

示例7: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {

	if(TaskRunner.getInstance().isClosing()){
		return;
	}


	Session session =  this.openSession();
	try {	
		Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
		View view = db.getView(Const.VIEW_USERS);
		Document doc = view.getFirstDocument();
		Document temp = null;
		while(doc!=null){
			String host = doc.getItemValueString(Const.FIELD_HOST);
			if(ServerInfo.getInstance().isCurrentServer(host)){
				String currentStatus= doc.getItemValueString(Const.FIELD_STATUS);
				//only update if we need to.
				if(!this.getStatus().equals(currentStatus)){
					doc.replaceItemValue(Const.FIELD_STATUS, this.getStatus());
					doc.save();
				}
			}

			temp = view.getNextDocument(doc);
			doc.recycle();
			doc = temp;
		}

	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);

	}finally{
		SessionFactory.closeSession(session);
	}

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:40,代码来源:StampAllUsers.java

示例8: recycle

import lotus.domino.Document; //导入方法依赖的package包/类
public static void recycle(Document doc){
	try {
		if(doc==null) return;
		doc.recycle();
	} catch (NotesException e) {
		logger.log(Level.SEVERE,null, e);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:9,代码来源:Recycler.java

示例9: createUser

import lotus.domino.Document; //导入方法依赖的package包/类
void createUser(Database db, String id, String firstName, String lastName, String city, String state, String email) throws NotesException {
	Document doc = db.createDocument();
	try {
		doc.replaceItemValue("Form","Contact");		
		doc.replaceItemValue("Id",id);		
		doc.replaceItemValue("FirstName",firstName);		
		doc.replaceItemValue("LastName",lastName);		
		doc.replaceItemValue("City",city);		
		doc.replaceItemValue("State",state);		
		doc.replaceItemValue("email",email);		
		doc.save();
	} finally {
		doc.recycle();
	}
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:16,代码来源:DataInitializer.java

示例10: createState

import lotus.domino.Document; //导入方法依赖的package包/类
void createState(Database db, String key, String name) throws NotesException {
	Document doc = db.createDocument();
	try {
		doc.replaceItemValue("Form","State");		
		doc.replaceItemValue("Key",key);		
		doc.replaceItemValue("Name",name);		
		doc.save();
	} finally {
		doc.recycle();
	}
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:12,代码来源:DataInitializer.java

示例11: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {

	if(TaskRunner.getInstance().isClosing()){
		return;
	}
	
	//exit if nobody on.
	if(server.getWebSocketCount() == 0) return;

	Session session = super.openSession();
	try {

		if(ServerInfo.getInstance().isCurrentServer(Config.getInstance().getBroadcastServer())){
			Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
			View view = db.getView(Const.VIEW_BROADCAST_QUEUE);
			view.setAutoUpdate(false);
			Document doc = view.getFirstDocument();
			Document temp = null;
			while(doc!=null){
				if(doc.isValid() && !doc.hasItem(StringCache.FIELD_CONFLICT)){
					this.buildDirectMessages(doc);
					doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_SENT);
					doc.save();
				}
				temp = view.getNextDocument(doc);
				doc.recycle();
				doc = temp;
			}
			
			
			view.setAutoUpdate(true);
		}
	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);

	}finally{
		super.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:42,代码来源:BroadcastQueueProcessor.java

示例12: offline

import lotus.domino.Document; //导入方法依赖的package包/类
/**
 * Offline.
 */
@Stopwatch
private void offline(){
	Session session = null;
	try {
		if(user!=null && !StrUtils.isEmpty(this.getSessionId())){

			session = this.openSession();

			Document doc = this.getUserDoc(session, false);

			if(doc==null) return;

			if(user.isOpen()==false){
				this.user.setStatus(Const.STATUS_OFFLINE);
			}else{
				this.user.setGoingOffline(false);//reset flag
			}

			doc.replaceItemValue(Const.FIELD_FORM, Const.FIELD_VALUE_USER);
			doc.replaceItemValue(Const.FIELD_SESSIONID, this.getSessionId());
			doc.replaceItemValue(Const.FIELD_STATUS, this.getStatus());
			doc.replaceItemValue(Const.FIELD_HOST, user.getHost());
			doc.replaceItemValue(Const.FIELD_URI, ColUtils.toVector(user.getUris()));
			doc.save();

			user.setDocId(doc.getUniversalID());

			//make sure if user transitioned from anonymous that doc is cleaned up
			this.deleteAnonymousDoc(session);

			doc.recycle();
		}

	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null, e);

	}finally{
		this.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:44,代码来源:ApplyStatus.java

示例13: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {

	if(TaskRunner.getInstance().isClosing()){
		return;
	}

	//if the message has already been persisted don't process it again.
	if(!msg.isPersisted()){

		Session session = this.openSession();
		try {
			//mark object as persisted so we don't keep persisting.
			msg.setPersisted(true);
			
			Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
			Document doc = db.createDocument();
			doc.replaceItemValue("Form", "fmSocketMessage");
			doc.replaceItemValue("text", msg.getText());
			doc.replaceItemValue("to", msg.getTo());
			doc.replaceItemValue("from", msg.getFrom());
			doc.replaceItemValue("event", StringCache.EMPTY);
			doc.replaceItemValue("durable", String.valueOf(msg.isDurable()));
			doc.replaceItemValue("persisted", String.valueOf(msg.isPersisted()));

			
			this.attach(doc, msg);

			db.recycle();
			doc.recycle();

		} catch (NotesException e) {
			LOG.log(Level.SEVERE,null, e);

		}finally{
			this.closeSession(session);
		}
	}

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:42,代码来源:QueueMessage.java

示例14: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
public void run() {
	if(TaskRunner.getInstance().isClosing()){
		return;
	}
	
	Session session = super.openSession();
	try {
		Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
		View view = db.getView(Const.VIEW_USERS);
		view.setAutoUpdate(false);
		Document doc = view.getFirstDocument();

		Document temp = null;
		while(doc!=null){
			//can't seem to stop this from happening in clustered environment (hack for now)	
			if(doc.isValid() && !doc.hasItem(StringCache.FIELD_CONFLICT)){ 
				IUser user = userFactory.createUser(doc);
				if(Const.STATUS_ONLINE.equals(user.getStatus()) && !ServerInfo.getInstance().isCurrentServer(user.getHost())){
					server.addUser(user);
					
					
				}else if(Const.STATUS_OFFLINE.equals(user.getStatus()) && !ServerInfo.getInstance().isCurrentServer(user.getHost())){
					server.removeUser(user);
					
				}
			}
			
			//cleanup the conflicts. (hack... need to revisit)
			else if( doc.isValid() && doc.hasItem(StringCache.FIELD_CONFLICT)){
				this.processConflict(doc);
			}
			
			
			temp = view.getNextDocument(doc);
			doc.recycle();
			doc = temp;
		}

		view.setAutoUpdate(true);
	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);

	}finally{
		super.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:48,代码来源:UserMonitor.java

示例15: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {
	
	if(TaskRunner.getInstance().isClosing()){
		return;
	}
	
	Session session = this.openSession();
	try {
		Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
		View view = db.getView(Const.VIEW_SERVER_STATUS);

		//first stamp the document with latest time stamp
		Document doc = view.getDocumentByKey(ServerInfo.getInstance().getServerName(),true);
		if(doc==null){
			doc = db.createDocument();
		}

		//update the server status doc.
		doc.replaceItemValue(Const.FIELD_HOST, ServerInfo.getInstance().getServerName());
		doc.replaceItemValue("updateDtm", db.getParent().createDateTime(new Date()));
		doc.replaceItemValue(Const.FIELD_STATUS, Const.STATUS_ONLINE);
		doc.replaceItemValue("Form", "fmServerStatus");
		doc.save();
		doc.recycle();

		//now check the server we're monitoring make sure its up.
		doc = view.getDocumentByKey(Config.getInstance().getClustermateMonitor(), true);
		if(doc!=null && Const.STATUS_ONLINE.equals(doc.getItemValueString(Const.FIELD_STATUS))){

			//calculate elapsedSeconds minus the thread run interval.
			long elapsedSeconds = DateUtils.getTimeDiffSec(doc.getLastModified().toJavaDate(), new Date()) - Const.CLUSTERMATE_MONITOR_INTERVAL;
			if(elapsedSeconds >= Config.getInstance().getClustermateExpiration()){
				this.setClustermateUsersOffline(db, Config.getInstance().getClustermateMonitor());
			}
		}

	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);

	}finally{
		this.closeSession(session);
	}

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:47,代码来源:ClustermateMonitor.java


注:本文中的lotus.domino.Document.recycle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。