メッセージをフォーマットして値を取得します。
@param recusrsive 変換したメッセージに対しても再帰的に処理するかどうか。
@return フォーマットしたメッセージ
@throws IllegalArgumentException 指定したメッセージコードが見つからない場合
350556
public String format(final boolean recusrsive) {
        
        final String message = MESSAGE_RESOLVER.getMessage(code)
                .orElseThrow(() -> new IllegalStateException(String.format("not found message key=%s", code)));
        
        return MESSAGE_INTERPOLATOR.interpolate(message, vars, recusrsive, MESSAGE_RESOLVER);
    }
292106
def recursiveRepr(self, stuff, thunk=repr):
        
        ID = id(stuff)
        if ID in self.active:
            return '%s(...)' % (stuff.__class__.__name__,)
        else:
            try:
                self.active[ID] = stuff
                return thunk(stuff)
            finally:
                del self.active[ID]
571083
protected CodeReviewAuditResponseV2 getErrorResponse(CollectorItem repoItem, String scmBranch, String scmUrl) {
        CodeReviewAuditResponseV2 noPRsCodeReviewAuditResponse = new CodeReviewAuditResponseV2();
        noPRsCodeReviewAuditResponse.addAuditStatus(CodeReviewAuditStatus.COLLECTOR_ITEM_ERROR);

        noPRsCodeReviewAuditResponse.setLastUpdated(repoItem.getLastUpdated());
        noPRsCodeReviewAuditResponse.setBranch(scmBranch);
        noPRsCodeReviewAuditResponse.setUrl(scmUrl);
        noPRsCodeReviewAuditResponse.setErrorMessage(repoItem.getErrors() == null ? null : repoItem.getErrors().get(0).getErrorMessage());
        return noPRsCodeReviewAuditResponse;
    }
673188
public final ASrvOrm<RS>
    lazyGetSrvOrm() throws Exception {
    String beanName = getSrvOrmName();
    @SuppressWarnings("unchecked")
    ASrvOrm<RS> srvOrm = (ASrvOrm<RS>) this.beansMap.get(beanName);
    if (srvOrm == null) {
      srvOrm = instantiateSrvOrm();
      srvOrm.setNewDatabaseId(this.newDatabaseId);
      srvOrm.setSrvDatabase(lazyGetSrvDatabase());
      srvOrm.setHlpInsertUpdate(lazyGetHlpInsertUpdate());
      srvOrm.setLogger(lazyGetLogger());
      srvOrm.setUtlReflection(lazyGetUtlReflection());
      srvOrm.setFctFillersObjectFields(lazyGetFctFillersObjectFields());
      srvOrm.setEntitiesFactoriesFatory(this.factoryBldServices
        .lazyGetFctBcFctSimpleEntities());
      FctBcCnvEntityToColumnsValues fctBcCnvEntityToColumnsValues =
        lazyGetFctBcCnvEntityToColumnsValues();
      srvOrm.setFactoryCnvEntityToColumnsValues(
        fctBcCnvEntityToColumnsValues);
      FillerEntitiesFromRs<RS> fillerEntitiesFromRs =
        lazyGetFillerEntitiesFromRs();
      srvOrm.setFillerEntitiesFromRs(fillerEntitiesFromRs);
      MngSettings mngOrmSettings = new MngSettings();
      mngOrmSettings.setLogger(lazyGetLogger());
      mngOrmSettings.setUtlReflection(lazyGetUtlReflection());
      mngOrmSettings.setUtlProperties(lazyGetUtlProperties());
      srvOrm.setMngSettings(mngOrmSettings);
      srvOrm.loadConfiguration(this.ormSettingsDir,
        this.ormSettingsBaseFile);
      fctBcCnvEntityToColumnsValues
        .setTablesMap(srvOrm.getTablesMap());
      lazyGetFctBnCnvBnFromRs().setTablesMap(srvOrm.getTablesMap());
      lazyGetFctBnCnvIbnToColumnValues().setTablesMap(srvOrm.getTablesMap());
      fillerEntitiesFromRs.setTablesMap(srvOrm.getTablesMap());
      Map<String, Object> addParam = new HashMap<String, Object>();
      lazyGetLogger().info(null, AFactoryAppBeans.class,
        "try to initialize database: " + getDatabaseName());
      srvOrm.initializeDatabase(addParam);
      this.entitiesMap = new HashMap<String, Class<?>>();
      for (Class<?> clazz : srvOrm.getMngSettings()
        .getClasses()) {
        this.entitiesMap.put(clazz.getSimpleName(), clazz);
      }
      this.beansMap.put(beanName, srvOrm);
      lazyGetLogger().info(null, AFactoryAppBeans.class, beanName
        + " has been created.");
    }
    return srvOrm;
  }
725014
public static Integer getDurationUnits(RecurringTask recurrence)
   {
      Duration duration = recurrence.getDuration();
      Integer result = null;

      if (duration != null)
      {
         result = UNITS_MAP.get(duration.getUnits());
      }

      return (result);
   }
1096329
@SuppressWarnings("checkstyle:npathcomplexity")
	private void createImplicitActionReturnType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {
		final List<XtendFunction> actions = EcoreUtil2.eAllOfType(resource.getContents().get(0), XtendFunction.class);

		for (final XtendFunction action : actions) {
			// inline annotation only for methods with no return type
			if (action.getReturnType() != null) {
				continue;
			}
			// get return type name from operation
			final JvmOperation inferredOperation = (JvmOperation) this.jvmModelAssocitions.getPrimaryJvmElement(action);
			if (inferredOperation == null || inferredOperation.getReturnType() == null) {
				continue;
			}
			// find document offset for inline annotationn
			final ICompositeNode node = NodeModelUtils.findActualNodeFor(action);
			final Keyword parenthesis = this.grammar.getAOPMemberAccess().getRightParenthesisKeyword_2_5_6_2();
			final Assignment fctname = this.grammar.getAOPMemberAccess().getNameAssignment_2_5_5();
			int offsetFctname = -1;
			int offsetParenthesis = -1;
			for (Iterator<INode> it = node.getAsTreeIterable().iterator(); it.hasNext();) {
				final INode child = it.next();
				if (child != node) {
					final EObject grammarElement = child.getGrammarElement();
					if (grammarElement instanceof RuleCall) {
						if (fctname.equals(grammarElement.eContainer())) {
							offsetFctname = child.getTotalEndOffset();
						}
					} else if (parenthesis.equals(grammarElement)) {
						offsetParenthesis = child.getTotalEndOffset();
						break;
					}
				}
			}
			int offset = -1;
			if (offsetParenthesis >= 0) {
				offset = offsetParenthesis;
			} else if (offsetFctname >= 0) {
				offset = offsetFctname;
			}
			if (offset >= 0) {
				final String returnType = inferredOperation.getReturnType().getSimpleName();
				final String text = " " + this.keywords.getColonKeyword() + " " + returnType; //$NON-NLS-1$ //$NON-NLS-2$
				acceptor.accept(createNewLineContentCodeMining(offset, text));
			}
		}
	}
494432
@SuppressWarnings("unchecked")
  @Override
  public D readRecordImpl(D reuse) throws DataRecordException, IOException {
    if (this.shutdownRequested.get()) {
      return null;
    }

    long readStartTime = System.nanoTime();

    while (!allPartitionsFinished()) {
      if (currentPartitionFinished()) {
        moveToNextPartition();
        continue;
      }
      if (this.messageIterator == null || !this.messageIterator.hasNext()) {
        try {
          long fetchStartTime = System.nanoTime();
          this.messageIterator = fetchNextMessageBuffer();
          this.currentPartitionFetchMessageBufferTime += System.nanoTime() - fetchStartTime;
        } catch (Exception e) {
          LOG.error(String.format("Failed to fetch next message buffer for partition %s. Will skip this partition.",
              getCurrentPartition()), e);
          moveToNextPartition();
          continue;
        }
        if (this.messageIterator == null || !this.messageIterator.hasNext()) {
          moveToNextPartition();
          continue;
        }
      }
      while (!currentPartitionFinished()) {
        if (!this.messageIterator.hasNext()) {
          break;
        }

        KafkaConsumerRecord nextValidMessage = this.messageIterator.next();

        // Even though we ask Kafka to give us a message buffer starting from offset x, it may
        // return a buffer that starts from offset smaller than x, so we need to skip messages
        // until we get to x.
        if (nextValidMessage.getOffset() < this.nextWatermark.get(this.currentPartitionIdx)) {
          continue;
        }

        this.nextWatermark.set(this.currentPartitionIdx, nextValidMessage.getNextOffset());
        try {
          // track time for decode/convert depending on the record type
          long decodeStartTime = System.nanoTime();

          D record = decodeKafkaMessage(nextValidMessage);

          this.currentPartitionDecodeRecordTime += System.nanoTime() - decodeStartTime;
          this.currentPartitionRecordCount++;
          this.currentPartitionTotalSize += nextValidMessage.getValueSizeInBytes();
          this.currentPartitionReadRecordTime += System.nanoTime() - readStartTime;
          this.currentPartitionLastSuccessfulRecord = record;
          return record;
        } catch (Throwable t) {
          this.errorPartitions.add(this.currentPartitionIdx);
          this.undecodableMessageCount++;
          if (shouldLogError()) {
            LOG.error(String.format("A record from partition %s cannot be decoded.", getCurrentPartition()), t);
          }
          incrementErrorCount();
        }
      }
    }
    LOG.info("Finished pulling topic " + this.topicName);

    this.currentPartitionReadRecordTime += System.nanoTime() - readStartTime;
    return null;
  }
383561
@Override
	public final MutableObjectIterator<T> getIterator() {
		final SingleSegmentInputView startIn = new SingleSegmentInputView(this.recordsPerSegment * this.recordSize);
		startIn.set(this.sortBuffer.get(0), 0);
		
		return new MutableObjectIterator<T>() {
			
			private final SingleSegmentInputView in = startIn;
			private final TypeComparator<T> comp = comparator;
			
			private final int numTotal = size();
			private final int numPerSegment = recordsPerSegment;
			
			private int currentTotal = 0;
			private int currentInSegment = 0;
			private int currentSegmentIndex = 0;

			@Override
			public T next(T reuse) {
				if (this.currentTotal < this.numTotal) {
					
					if (this.currentInSegment >= this.numPerSegment) {
						this.currentInSegment = 0;
						this.currentSegmentIndex++;
						this.in.set(sortBuffer.get(this.currentSegmentIndex), 0);
					}
					
					this.currentTotal++;
					this.currentInSegment++;
					
					try {
						return this.comp.readWithKeyDenormalization(reuse, this.in);
					}
					catch (IOException ioe) {
						throw new RuntimeException(ioe);
					}
				}
				else {
					return null;
				}
			}
		};
	}
303016
private OnePidRecordListImpl restartRecordsInProcess(final RepositoryLogRecord after, long max, final IInternalRecordFilter recFilter) {
		if (!(after instanceof RepositoryLogRecordImpl)) {
			throw new IllegalArgumentException("Specified location does not belong to this repository.");
		}
		RepositoryLogRecordImpl real = (RepositoryLogRecordImpl)after;
		File file = fileBrowser.findByMillis(real.getMillis());
		// If record's time is not in our repository, take the first file
		if (file == null) {
			file = fileBrowser.findNext((File)null, max);
		}
		return new OnePidRecordListRecordImpl(file, real, max, recFilter);
	}
933045
public void run() throws IllegalArgumentException {
        List<List<ResultEntry>> groups = null;

        for (int i = 0; i < this.repeatedRuns; ++i) {
            this.solver.getResult().clearResults();
            this.solver.run();
            Result result = this.solver.getResult();

            if (groups == null) {
                // create empty groups
                groups = new ArrayList<List<ResultEntry>>(result.getResultEntries().size());
                // allocate space in every group
                for (int j = 0; j < result.getResultEntries().size(); ++j) {
                    groups.add(new ArrayList<ResultEntry>(this.repeatedRuns));
                }
            }

            if (result.getResultEntries().size() != groups.size())
                throw new IllegalArgumentException(String.format(
                        "Wrapped solver must return result with identical number of elements each run, " +
                        "given %d in run %d, expected %d",
                        result.getResultEntries().size(), i, groups.size()));

            for (int j = 0; j < result.getResultEntries().size(); j++) {
                ResultEntry resultEntry = result.getResultEntries().get(j);

                groups.get(j).add(resultEntry);
            }
        }

        int middleIndex = this.repeatedRuns / 2;

        for (List<ResultEntry> group : groups) {
            Collections.sort(group, new ResultEntryFitnessComparator());

            if (this.logger.isDebugEnabled()) {
                this.logger.debug("Sorted result entries, dump:");
                for (int i = 0; i < group.size(); i++) {
                    ResultEntry resultEntry = group.get(i);
                    this.logger.debug(i + ". " + resultEntry.getBestFitness());
                }
            }

            this.getResult().addEntry(group.get(middleIndex));
        }


        if (this.file != null) {
            try {
                PrintStream printStream = new PrintStream(file);
                for (List<ResultEntry> group : groups) {
                    printStream.printf("Sorted entries for %s/%s\n", group.get(0).getAlgorithm(), group.get(0).getProblem());
                    for (int i = 0; i < group.size(); i++) {
                        printStream.printf("%03d. %.5f\n", i, group.get(i).getBestFitness());
                    }
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
    }
1237741
private void reconstituteRemoteQueuePoints(int startMode,
                                               boolean isSystem)
                    throws SIDiscriminatorSyntaxException, MessageStoreException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc,
                        "reconstituteRemoteQueuePoints",
                        new Object[] {
                                      Integer.valueOf(startMode),
                                      Boolean.valueOf(isSystem),
                                      this });

        // Next look for any remote transmission itemstreams to queue points
        int transmissionQCount = 0;
        PtoPXmitMsgsItemStream ptoPXmitMsgsItemStream = null;

        // There can be one or more transmission itemstreams in the BaseDestinationHandler.
        NonLockingCursor cursor =
                        _baseDestinationHandler.newNonLockingItemStreamCursor(
                                        new ClassEqualsFilter(PtoPXmitMsgsItemStream.class));

        do
        {
            ptoPXmitMsgsItemStream = (PtoPXmitMsgsItemStream) cursor.next();

            if (ptoPXmitMsgsItemStream != null)
            {
                ptoPXmitMsgsItemStream.reconstitute(_baseDestinationHandler);

                if (ptoPXmitMsgsItemStream.isToBeDeleted())
                {
                    ptoPXmitMsgsItemStream.setDeleteRequiredAtReconstitute(true);
                    SIBUuid8 remoteMEUuid = ptoPXmitMsgsItemStream.getLocalizingMEUuid();
                    _postMediatedItemStreamsRequiringCleanup.put(
                                                                 remoteMEUuid, ptoPXmitMsgsItemStream);
                    _baseDestinationHandler.setHasReconciledStreamsToBeDeleted(true);
                    _localisationManager.
                                    attachRemotePtoPLocalisation(ptoPXmitMsgsItemStream,
                                                                 _remoteSupport);
                    // Reconstitute source streams for PtoPOutputHandler
                    _remoteSupport.reconstituteSourceStreams(startMode,
                                                             (PtoPOutputHandler) ptoPXmitMsgsItemStream.getOutputHandler());
                    assignQueuePointOutputHandler(
                                                  ptoPXmitMsgsItemStream.getOutputHandler(),
                                                  ptoPXmitMsgsItemStream.getLocalizingMEUuid());
                }
                else
                {
                    transmissionQCount++;
                    _localisationManager.
                                    attachRemotePtoPLocalisation(ptoPXmitMsgsItemStream,
                                                                 _remoteSupport);
                    // Reconstitute source streams for PtoPOutputHandler
                    _remoteSupport.reconstituteSourceStreams(startMode,
                                                             (PtoPOutputHandler) ptoPXmitMsgsItemStream.getOutputHandler());

                    /* Feature 176658.3.2 */
                    assignQueuePointOutputHandler(
                                                  ptoPXmitMsgsItemStream.getOutputHandler(),
                                                  ptoPXmitMsgsItemStream.getLocalizingMEUuid());

                    //Restore the guess sets for system destinations
                    if (isSystem)
                    {
                        _localisationManager.addMEToQueuePointGuessSet(ptoPXmitMsgsItemStream.getLocalizingMEUuid());
                        _localisationManager.addMEToRemoteQueuePointGuessSet(ptoPXmitMsgsItemStream.getLocalizingMEUuid());
                    }
                }
            }
        } while (ptoPXmitMsgsItemStream != null);

        cursor.finished();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "reconstituteRemoteQueuePoints");

    }
1193842
public CaptureSearchResult adapt(WARCRecord rec) {
		try {
			return adaptInner(rec);
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		} catch (OutOfMemoryError e) {
			e.printStackTrace();
			return null;
		}
	}
244183
private OnePidRecordListImpl restartRecordsInProcess(final RepositoryPointer after, long max, final IInternalRecordFilter recFilter) {
		if (!(after instanceof RepositoryPointerImpl)) {
			throw new IllegalArgumentException("Specified location does not belong to this repository.");
		}
		return new OnePidRecordListLocationImpl((RepositoryPointerImpl)after, max, recFilter);
	}
150015
ArgumentMarshaller getArgumentMarshaller(final Method getter) {

        synchronized (argumentMarshallerCache) {
            if ( !argumentMarshallerCache.containsKey(getter) ) {
                ArgumentMarshaller marshaller = null;

                if ( isCustomMarshaller(getter) ) {
                    marshaller = new ArgumentMarshaller() {

                        @Override
                        public AttributeValue marshall(Object obj) {
                            return getCustomerMarshallerAttributeValue(getter, obj);
                        }
                    };
                } else {

                    Class<?> returnType = getter.getReturnType();
                    if ( Set.class.isAssignableFrom(returnType) ) {
                        Type genericType = getter.getGenericReturnType();
                        if ( genericType instanceof ParameterizedType ) {
                            if ( ((ParameterizedType) genericType).getActualTypeArguments()[0].toString().equals("byte[]") ) {
                                returnType = byte[].class;
                            } else {
                                returnType = (Class<?>) ((ParameterizedType) genericType).getActualTypeArguments()[0];
                            }
                        }

                        if ( Date.class.isAssignableFrom(returnType) ) {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    List<String> timestamps = new LinkedList<String>();
                                    for ( Object o : (Set<?>) obj ) {
                                        timestamps.add(DateUtils.formatISO8601Date((Date) o));
                                    }
                                    return new AttributeValue().withSS(timestamps);
                                }
                            };
                        } else if ( Calendar.class.isAssignableFrom(returnType) ) {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    List<String> timestamps = new LinkedList<String>();
                                    for ( Object o : (Set<?>) obj ) {
                                        timestamps.add(DateUtils.formatISO8601Date(((Calendar) o).getTime()));
                                    }
                                    return new AttributeValue().withSS(timestamps);
                                }
                            };
                        } else if ( boolean.class.isAssignableFrom(returnType)
                                || Boolean.class.isAssignableFrom(returnType) ) {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    List<String> booleanAttributes = new ArrayList<String>();
                                    for ( Object b : (Set<?>) obj ) {
                                        if ( b == null || !(Boolean) b ) {
                                            booleanAttributes.add("0");
                                        } else {
                                            booleanAttributes.add("1");
                                        }
                                    }
                                    return new AttributeValue().withNS(booleanAttributes);
                                }
                            };
                        } else if ( returnType.isPrimitive() || Number.class.isAssignableFrom(returnType) ) {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    List<String> attributes = new ArrayList<String>();
                                    for ( Object o : (Set<?>) obj ) {
                                        attributes.add(String.valueOf(o));
                                    }
                                    return new AttributeValue().withNS(attributes);
                                }
                            };
                        } else if (ByteBuffer.class.isAssignableFrom(returnType)) {
                        	 marshaller = new ArgumentMarshaller() {

                                 @Override
                                 public AttributeValue marshall(Object obj) {
                                     List<ByteBuffer> attributes = new ArrayList<ByteBuffer>();
                                     for ( Object o : (Set<?>) obj ) {
                                         attributes.add((ByteBuffer) o);
                                     }
                                     return new AttributeValue().withBS(attributes);
                                 }
                             };
                        } else if (byte[].class.isAssignableFrom(returnType)) { 
                        	 marshaller = new ArgumentMarshaller() {

                                 @Override
                                 public AttributeValue marshall(Object obj) {
                                     List<ByteBuffer> attributes = new ArrayList<ByteBuffer>();
                                     for ( Object o : (Set<?>) obj ) {
                                         attributes.add(ByteBuffer.wrap((byte[])o));
                                     }
                                     return new AttributeValue().withBS(attributes);
                                 }
                             };
                        } else {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    List<String> attributes = new ArrayList<String>();
                                    for ( Object o : (Set<?>) obj ) {
                                        attributes.add(String.valueOf(o));
                                    }
                                    return new AttributeValue().withSS(attributes);
                                }
                            };
                        }
                    } else if ( Collection.class.isAssignableFrom(returnType) ) {
                        throw new DynamoDBMappingException("Non-set collections aren't supported: "
                                + (getter.getDeclaringClass() + "." + getter.getName()));
                    } else {
                        if ( Date.class.isAssignableFrom(returnType) ) {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    return new AttributeValue().withS(DateUtils.formatISO8601Date((Date) obj));
                                }
                            };
                        } else if ( Calendar.class.isAssignableFrom(returnType) ) {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    return new AttributeValue().withS(DateUtils
                                            .formatISO8601Date(((Calendar) obj).getTime()));
                                }
                            };
                        } else if ( boolean.class.isAssignableFrom(returnType)
                                || Boolean.class.isAssignableFrom(returnType) ) {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    if ( obj == null || !(Boolean) obj ) {
                                        return new AttributeValue().withN("0");
                                    } else {
                                        return new AttributeValue().withN("1");
                                    }
                                }
                            };
                        } else if ( returnType.isPrimitive() || Number.class.isAssignableFrom(returnType) ) {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    return new AttributeValue().withN(String.valueOf(obj));
                                }
                            };
                        } else if ( returnType == String.class ) {
                            marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    if ( ((String) obj).length() == 0 )
                                        return null;
                                    return new AttributeValue().withS(String.valueOf(obj));
                                }
                            };
                        } else if ( returnType == ByteBuffer.class ) {
                        	marshaller = new ArgumentMarshaller() {

                                @Override
                                public AttributeValue marshall(Object obj) {
                                    return new AttributeValue().withB((ByteBuffer)obj);
                                }
                            };
                        } else if ( returnType == byte[].class) {
                        	 marshaller = new ArgumentMarshaller() {

                                 @Override
                                 public AttributeValue marshall(Object obj) {
                                     return new AttributeValue().withB(ByteBuffer.wrap((byte[])obj));
                                 }
                             };
                        } else {
                            throw new DynamoDBMappingException("Unsupported type: " + returnType + " for " + getter);
                        }
                    }
                }
                argumentMarshallerCache.put(getter, marshaller);
            }
        }

        return argumentMarshallerCache.get(getter);
    }
784561
public CaptureSearchResult adapt(ARCRecord rec) {
		try {
			return adaptInner(rec);
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}
	}
875422
@Override
	public final AbstractMessage receiveFromDestination(long timeout, boolean duplicateRequired) throws JMSException
    {
    	synchronized (receiveLock)
		{
	        if (closed)
	            return null; // [JMS SPEC]
	        
	        if (receiving)
	        	throw new FFMQException("Consumer should not be accessed by more than one thread","ILLEGAL_USAGE");
	        
	        receiving = true;
	        try
	        {
		        MessageSelector selector = getReceiveSelector();
		        
		        // No-wait simplified case
		        if (timeout == 0)
		        {
		        	if (!connection.isStarted())
		        		return null;
		        	
		        	AbstractMessage message = localQueue.get((LocalSession)session,
						            						 transactionSet,
					                                         selector);        	
		            if (message == null)
		            	return null;
		            
		        	if (traceEnabled)
		                log.trace(session+" [GET] in "+localQueue+" - "+message);
		
		        	if (duplicateRequired)
		        		message = MessageTools.duplicate(message);
		            message.markAsReadOnly();
		            
		            return message;
		        }
			
		        // Wait loop
		        long now = System.currentTimeMillis();
		        long startTime = now;
		        
		        // Passive wait
		        while (!closed && (timeout < 0 || (now - startTime < timeout)))
		        {
		        	// Don't do anything if connection is not started
		    		if (connection.isStarted())
		    		{
		                // Try obtaining something from target queue
		    			AbstractMessage message = localQueue.get((LocalSession)session,
		    					                                 transactionSet,
		    					                                 selector);
			            if (message != null)
			            {
			                if (traceEnabled)
			                    log.trace(session+" [GET] in "+localQueue+" - "+message);
			                
			                if (duplicateRequired)
				        		message = MessageTools.duplicate(message);
				            message.markAsReadOnly();
				            
				            return message;
			            }
		    		}
		            
		            if (traceEnabled)
		                log.trace("Entering passive wait on "+localQueue+" (timeout="+timeout+")");
		            
		            try
		            {
		                if (timeout <= 0)
		                	receiveLock.wait();
		                else
		                	receiveLock.wait(timeout - (now - startTime));
		            }
		            catch (InterruptedException e)
		            {
		                return null;
		            }
		
		            now = System.currentTimeMillis();
		        }
		        
		        return null;
	        }
	        finally
	        {
	        	receiving = false;
	        }
		}
    }
1285347
private RequestArguments.Argument arg(Request R) {
      if( _arg != null ) return _arg;
      Class clzz = R.getClass();
      // An amazing crazy API from the JDK again.  Cannot search for protected
      // fields without either (1) throwing NoSuchFieldException if you ask in
      // a subclass, or (2) sorting through the list of ALL fields and EACH
      // level of the hierarchy.  Sadly, I catch NSFE & loop.
      while( true ) {
        try {
          Field field = clzz.getDeclaredField(_name);
          field.setAccessible(true);
          Object o = field.get(R);
          return _arg=((RequestArguments.Argument)o);
        }
        catch(   NoSuchFieldException ie ) { clzz = clzz.getSuperclass(); }
        catch( IllegalAccessException ie ) { break; }
        catch( ClassCastException ie ) { break; }
      }
      return null;
    }