Example usage for java.lang Thread setName

List of usage examples for java.lang Thread setName

Introduction

In this page you can find the example usage for java.lang Thread setName.

Prototype

public final synchronized void setName(String name) 

Source Link

Document

Changes the name of this thread to be equal to the argument name .

Usage

From source file:org.apache.hive.spark.client.SparkClientImpl.java

private void redirect(String name, Redirector redirector) {
    Thread thread = new Thread(redirector);
    thread.setName(name);
    thread.setDaemon(true);//from  w  w w .  ja  v  a2s . c  o m
    thread.start();
}

From source file:msearch.filmeSuchen.sender.MediathekSrf.java

@Override
public void addToList() {
    //Liste von http://www.srf.ch/player/tv/sendungen?displayedKey=Alle holen
    //<a class="sendung_name" href="/player/tv/sendung/1-gegen-100?id=6fd27ab0-d10f-450f-aaa9-836f1cac97bd">1 gegen 100</a>
    final String MUSTER = "sendung_name\" href=\"";
    final String PATTERN_END = "\"";
    final String THEME_PATTERN_START = ">";
    final String THEME_PATTERN_END = "<";
    final String URL_PREFIX = "http://srf.ch";
    MSStringBuilder seite = new MSStringBuilder(MSConst.STRING_BUFFER_START_BUFFER);
    listeThemen.clear();/*from  w w w  .  j  a va2s .  c o m*/
    meldungStart();
    seite = getUrlIo.getUri_Utf(SENDERNAME, "http://www.srf.ch/player/tv/sendungen?displayedKey=Alle", seite,
            "");
    int pos = 0;
    int pos1;
    String url;
    String thema;

    //        System.out.println("Alles Laden " + MSConfig.senderAllesLaden);
    while ((pos = seite.indexOf(MUSTER, pos)) != -1) {
        pos1 = pos;
        pos += MUSTER.length();

        url = URL_PREFIX + seite.extract(MUSTER, PATTERN_END, pos1);
        thema = seite.extract(THEME_PATTERN_START, THEME_PATTERN_END, pos1);
        listeThemen.addUrl(new String[] { url, thema });
        //            System.out.println("URL " + url);
        //            System.out.println("THEMA " + thema);
        //            System.out.println(pos);

    }

    if (MSConfig.getStop()) {
        meldungThreadUndFertig();
    } else if (listeThemen.size() == 0) {
        meldungThreadUndFertig();
    } else {
        meldungAddMax(listeThemen.size());
        for (int t = 0; t < maxThreadLaufen; ++t) {
            Thread th = new Thread(new ThemaLaden());
            th.setName(SENDERNAME + t);
            th.start();
        }
    }
}

From source file:org.jwebsocket.jms.endpoint.JMSEndPointSender.java

/**
 *
 * @param aTargetId/*from  w ww.  ja v  a 2s . c om*/
 * @param aCorrelationID
 * @param aText
 * @param aResponseListener
 * @param aTimeout
 */
public synchronized void sendText(String aTargetId, final String aCorrelationID, final String aText,
        IJMSResponseListener aResponseListener, long aTimeout) {
    Message lMsg;
    try {
        lMsg = mSession.createTextMessage(aText);
        if (null != aCorrelationID) {
            lMsg.setJMSCorrelationID(aCorrelationID);
        }
        lMsg.setStringProperty("targetId", aTargetId);
        lMsg.setStringProperty("sourceId", mEndPointId);

        if (mLog.isDebugEnabled()) {
            StringBuilder lPropStr = new StringBuilder();
            Enumeration lPropNames = lMsg.getPropertyNames();
            while (lPropNames.hasMoreElements()) {
                String lPropName = (String) lPropNames.nextElement();
                Object lValue = lMsg.getObjectProperty(lPropName);
                lPropStr.append(lPropName).append("=").append(lValue);
                if (lPropNames.hasMoreElements()) {
                    lPropStr.append(", ");
                }
            }
            mLog.debug("Sending text to '" + aTargetId + "': "
                    + (JMSLogging.isFullTextLogging() ? aText
                            : "[content suppressed, length: " + aText.length() + " bytes]")
                    + ", props: " + lPropStr + "...");
        }

        // processing callbacks
        if (null != aResponseListener) {
            Assert.notNull(aCorrelationID, "The 'correlationID' argument cannot be null!");
            Assert.isTrue(aTimeout > 0, "Invalid 'timeout' argument. Expecting 'timeout' > 0");
            // setting the expiration time
            lMsg.setJMSExpiration(aTimeout);

            // saving the callback 
            mResponseListeners.put(aCorrelationID, aResponseListener);

            // schedule the timer task
            Tools.getTimer().schedule(new JWSTimerTask() {
                @Override
                public void runTask() {
                    Thread lThread = new Thread() {
                        @Override
                        public void run() {
                            IJMSResponseListener lListener = mResponseListeners.remove(aCorrelationID);
                            if (null != lListener) {
                                lListener.onTimeout();
                            }
                        }
                    };
                    lThread.setName("JMSEndPointSender Timeout Thread");
                    Tools.getThreadPool().submit(lThread);
                }
            }, aTimeout);
        }

        mProducer.send(lMsg);

    } catch (JMSException lEx) {
        mLog.error(lEx.getClass().getSimpleName() + " sending message: " + lEx.getMessage() + " "
                + ExceptionUtils.getStackTrace(lEx));
    }
}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.Discovery_Freshness_ForcePing.java

/**
 * Send the Lqi_Request for the selected address. Then manages the
 * Lqi_Response/* ww  w  .j  a  v a2s.  c o  m*/
 */
public void startLqi(Address aoi, TypeFunction function, short startIndex) {
    if (getGal().getDataLayer().getDestroy())
        return;
    WrapperWSNNode __currentNodeWrapper = new WrapperWSNNode(getGal(),
            String.format("%04X", aoi.getNetworkAddress()));
    WSNNode node = new WSNNode();
    node.setAddress(aoi);
    __currentNodeWrapper.set_node(node);
    __currentNodeWrapper = getGal().getFromNetworkCache(__currentNodeWrapper);
    if (__currentNodeWrapper == null)
        return;
    String functionName = null;
    if (function == TypeFunction.DISCOVERY) {
        __currentNodeWrapper.set_executingDiscovery(true);
        functionName = "Discovery";
    } else if (function == TypeFunction.FRESHNESS) {
        __currentNodeWrapper.set_executingFreshness(true);
        functionName = "Freshness";
    } else if (function == TypeFunction.FORCEPING) {
        __currentNodeWrapper.set_executingForcePing(true);
        functionName = "ForcePing";
    }

    Mgmt_LQI_rsp _Lqi = null;

    if (getGal().getGatewayStatus() == GatewayStatus.GW_RUNNING) {
        try {
            /* PostPoning Timer Freshness */
            if (function == TypeFunction.FORCEPING) {
                if (getGal().getPropertiesManager().getKeepAliveThreshold() > 0) {
                    __currentNodeWrapper
                            .setTimerFreshness(getGal().getPropertiesManager().getKeepAliveThreshold());
                    LOG.debug("Postponing  timer Freshness by ForcePing for node: {}",
                            Utils.getAddressString(aoi));
                }
            }

            LOG.debug("Sending LQI_REQ ( {} ) for node: {}", functionName,
                    Utils.getAddressString(aoi) + " -- StartIndex:" + startIndex);
            /* Executing Lqi Request */
            _Lqi = getGal().getDataLayer()
                    .Mgmt_Lqi_Request(getGal().getPropertiesManager().getCommandTimeoutMS(), aoi, startIndex);
            /* Check no Response received */
            if (_Lqi == null) {
                manageError(function, startIndex, __currentNodeWrapper,
                        new Exception("LqiReq.Response not received!"));
            } else/* Response Received */
            {

                short _totalLqi = _Lqi._NeighborTableEntries;
                short _indexLqi = _Lqi._StartIndex;
                short _LqiListCount = _Lqi._NeighborTableListCount;

                LOG.info("Received LQI_RSP ( {} ) for node: {}", functionName,
                        Utils.getAddressString(aoi) + " -- StartIndex:" + _indexLqi);

                AssociatedDevices _AssociatedDevices = new AssociatedDevices();
                if (_Lqi.NeighborTableList != null && _Lqi.NeighborTableList.size() > 0) {
                    for (NeighborTableLis_Record x : _Lqi.NeighborTableList) {
                        manageChildNode(aoi, function, functionName, _AssociatedDevices, x);
                    }
                }

                __currentNodeWrapper.reset_numberOfAttempt();
                __currentNodeWrapper.set_discoveryCompleted(true);

                if ((_indexLqi + _LqiListCount) < _totalLqi) {
                    if (_LqiListCount == 0x00) {

                        synchronized (__currentNodeWrapper.get_node().getAssociatedDevices()) {
                            __currentNodeWrapper.get_node().getAssociatedDevices().clear();
                        }

                        LOG.debug("patch that correct a 4-noks bug - 07-12-2011");

                        if (function == TypeFunction.FRESHNESS)
                            if (getGal().getPropertiesManager().getKeepAliveThreshold() > 0) {
                                if (!__currentNodeWrapper.isDead()) {
                                    __currentNodeWrapper.set_executingFreshness(false);
                                    __currentNodeWrapper.setTimerFreshness(
                                            getGal().getPropertiesManager().getKeepAliveThreshold());
                                }
                            }
                        if (function == TypeFunction.FORCEPING)
                            if (getGal().getPropertiesManager().getForcePingTimeout() > 0) {
                                if (!__currentNodeWrapper.isDead()) {
                                    __currentNodeWrapper.set_executingForcePing(false);
                                    __currentNodeWrapper.setTimerForcePing(
                                            getGal().getPropertiesManager().getForcePingTimeout());
                                }
                            }
                        if (function == TypeFunction.DISCOVERY) {
                            if (!__currentNodeWrapper.isDead())
                                __currentNodeWrapper.set_executingDiscovery(false);
                        }
                        LOG.info("{} completed for node: {}", functionName,
                                Utils.getAddressString(__currentNodeWrapper.get_node().getAddress()));

                        /* Executing the NodeDiscovered */
                        if ((function == TypeFunction.FORCEPING) || (function == TypeFunction.DISCOVERY)) {
                            Status _s = new Status();
                            _s.setCode((short) 0x00);
                            _s.setMessage("Successful - " + functionName + " Algorithm");
                            LOG.debug("Starting nodeDiscovered from function: {} Node: {}", functionName,
                                    Utils.getAddressString(__currentNodeWrapper.get_node().getAddress()));
                            LOG.info("\n\rNodeDiscovered From LQI:"
                                    + String.format("%04X",
                                            __currentNodeWrapper.get_node().getAddress().getNetworkAddress())
                                    + "\n\r");
                            getGal().get_gatewayEventManager().nodeDiscovered(_s,
                                    __currentNodeWrapper.get_node());
                            LOG.debug("Started nodeDiscovered from function: {} Node: {}", functionName,
                                    Utils.getAddressString(__currentNodeWrapper.get_node().getAddress()));
                        }
                        return;
                    }
                    /* _LqiListCount != 0 */
                    else {
                        if (__currentNodeWrapper.get_Mgmt_LQI_rsp() != null
                                && __currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList != null) {
                            if (__currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList.size() > 0) {
                                synchronized (__currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList) {
                                    if (startIndex == 0x00) {
                                        __currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList.clear();
                                    }
                                    __currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList
                                            .addAll(_Lqi.NeighborTableList);
                                }
                            } else
                                __currentNodeWrapper.set_Mgmt_LQI_rsp(_Lqi);

                        } else
                            __currentNodeWrapper.set_Mgmt_LQI_rsp(_Lqi);
                    }
                    synchronized (__currentNodeWrapper.get_node().getAssociatedDevices()) {
                        __currentNodeWrapper.get_node().getAssociatedDevices().add(_AssociatedDevices);
                    }
                    List<Object> parameters = new ArrayList<Object>();
                    short nextStartIndex = (short) (_indexLqi + _LqiListCount);
                    parameters.add(nextStartIndex);
                    parameters.add(aoi);
                    parameters.add(function);

                    Runnable thr = new MyRunnable(parameters) {
                        @Override
                        public void run() {
                            List<Object> parameters = (List<Object>) (this.getParameter());
                            Short _indexLqi = (Short) parameters.get(0);
                            Address node = (Address) parameters.get(1);
                            TypeFunction function = (TypeFunction) parameters.get(2);
                            LOG.info("Executing Thread -- LqiReq Node: {} StartIndex: {}",
                                    Utils.getAddressString(node), _indexLqi);
                            startLqi(node, function, _indexLqi);
                            return;
                        }
                    };
                    Thread thr0 = new Thread(thr);
                    thr0.setName("Node:" + String.format("%04X", aoi.getNetworkAddress()) + " -- "
                            + functionName + " StartIndex:" + nextStartIndex);
                    thr0.start();

                }
                /* !((_indexLqi + _LqiListCount) < _totalLqi) */
                else {
                    if (__currentNodeWrapper.get_Mgmt_LQI_rsp() != null
                            && __currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList != null) {
                        if (__currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList.size() > 0) {
                            synchronized (__currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList) {
                                if (startIndex == 0x00) {
                                    __currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList.clear();
                                }
                                __currentNodeWrapper.get_Mgmt_LQI_rsp().NeighborTableList
                                        .addAll(_Lqi.NeighborTableList);
                            }
                        } else
                            __currentNodeWrapper.set_Mgmt_LQI_rsp(_Lqi);
                    } else
                        __currentNodeWrapper.set_Mgmt_LQI_rsp(_Lqi);

                    if (function == TypeFunction.FRESHNESS)
                        if (getGal().getPropertiesManager().getKeepAliveThreshold() > 0)
                            if (!__currentNodeWrapper.isDead()) {
                                __currentNodeWrapper.set_executingFreshness(false);
                                __currentNodeWrapper.setTimerFreshness(
                                        getGal().getPropertiesManager().getKeepAliveThreshold());
                            }
                    if (function == TypeFunction.FORCEPING)
                        if (getGal().getPropertiesManager().getForcePingTimeout() > 0)
                            if (!__currentNodeWrapper.isDead()) {
                                __currentNodeWrapper.set_executingForcePing(false);

                                __currentNodeWrapper.setTimerForcePing(
                                        getGal().getPropertiesManager().getForcePingTimeout());
                            }
                    if (function == TypeFunction.DISCOVERY) {
                        if (!__currentNodeWrapper.isDead())
                            __currentNodeWrapper.set_executingDiscovery(false);
                    }
                    LOG.debug("{} completed for node: {}", functionName, String.format("%04X",
                            __currentNodeWrapper.get_node().getAddress().getNetworkAddress()));

                    /* Executing the NodeDiscovered */
                    if ((function == TypeFunction.FORCEPING) || (function == TypeFunction.DISCOVERY)) {
                        Status _s = new Status();
                        _s.setCode((short) 0x00);
                        _s.setMessage("Successful - " + functionName + " Algorithm");
                        LOG.debug("Starting nodeDiscovered from function: {} Node: {}", functionName,
                                Utils.getAddressString(__currentNodeWrapper.get_node().getAddress()));
                        LOG.info("\n\rNodeDiscovered From LQI: {}",
                                Utils.getAddressString(__currentNodeWrapper.get_node().getAddress()) + "\n\r");
                        getGal().get_gatewayEventManager().nodeDiscovered(_s, __currentNodeWrapper.get_node());
                        LOG.debug("Started nodeDiscovered from function: {} Node: {}", functionName,
                                Utils.getAddressString(__currentNodeWrapper.get_node().getAddress()));
                    }

                }

            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (Exception e) {
            manageError(function, startIndex, __currentNodeWrapper, e);
            e.printStackTrace();
        }
    }
}

From source file:org.intermine.sql.Database.java

/**
 * Executes an SQL statement on the database in a separate thread. A certain number of worker
 * threads controlled by the "parallel" property will operate simultaneously.
 *
 * @param sql an SQL string./*  www  .jav a  2s. co m*/
 * @throws SQLException if an error has been reported by a previous operation - however, this
 * does not cancel the current operation.
 */
public void executeSqlInParallel(String sql) throws SQLException {
    SqlJob job = new SqlJob(sql);
    synchronized (this) {
        pending.add(job);
    }
    boolean notDone = true;
    while (notDone) {
        try {
            queue.put(job);
            notDone = false;
        } catch (InterruptedException e) {
            // Not done
        }
    }
    synchronized (this) {
        if (workers.size() < parallel) {
            Worker worker = new Worker(threadNo);
            Thread thread = new Thread(worker);
            thread.setDaemon(true);
            thread.setName("Database background thread " + threadNo);
            threadNo++;
            workers.add(worker);
            thread.start();
        }
        if (reportedException != null) {
            SQLException re = new SQLException("Error while executing SQL");
            re.initCause(reportedException);
            reportedException = null;
            throw re;
        }
    }
}

From source file:com.nesscomputing.db.postgres.embedded.EmbeddedPostgreSQL.java

private Thread newCloserThread() {
    final Thread closeThread = new Thread(new Runnable() {
        @Override//from ww  w .j  ava2s .co m
        public void run() {
            try {
                Closeables.close(EmbeddedPostgreSQL.this, true);
            } catch (IOException ex) {
                LOG.error("Unexpected IOException from Closeables.close", ex);
            }
        }
    });
    closeThread.setName("postgres-" + instanceId + "-closer");
    return closeThread;
}

From source file:edu.wisc.commons.httpclient.CleanShutdownPoolingClientConnectionManager.java

@Override
public void shutdown() {
    if (shutdownComplete.get() || !this.shutdownLock.tryLock()) {
        //Already shutdown or shutdown in progress
        return;//w w w  . ja va  2  s  .  co m
    }

    try {
        //Create Thread to call shutdown
        final Thread shutdownThread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    logger.info("PoolingClientConnectionManager shutdown started");
                    CleanShutdownPoolingClientConnectionManager.super.shutdown();
                } finally {
                    shutdownComplete.set(true);
                    logger.info("PoolingClientConnectionManager shutdown complete");
                }
            }
        });
        shutdownThread.setName("PoolingClientConnectionManager Shutdown Monitor");
        shutdownThread.setDaemon(true);

        //start shutdown thread
        shutdownThread.start();

        //track initial shutdown start time and time spent by the shutdown thread waiting or blocked
        final long shutdownStart = System.nanoTime();
        long waitStart = shutdownStart;

        //Monitor the shutdown thread
        while (!shutdownComplete.get()) {
            final long now = System.nanoTime();
            final long shutdownTime = TimeUnit.NANOSECONDS.toMillis(now - shutdownStart);

            //if time spent shutting down is greater than kill time forcibly stop the shutdown thread
            if (shutdownTime > this.shutdownThreadKillTime) {
                final String stackTrace = getStackTrace(shutdownThread);
                logger.error("Shutdown thread " + shutdownThread.getName() + " has been stopping for "
                        + shutdownTime + "ms, killing it. THIS IS BAD. \n" + stackTrace);
                shutdownThread.stop();

                //break out of the monitoring loop
                break;
            }
            //if time spent shutting down is greater than max time immediately interrupt the thread
            else if (shutdownTime > this.shutdownThreadMaxTime) {
                logger.warn("Shutdown thread " + shutdownThread.getName() + " has been stopping for "
                        + shutdownTime + "ms, interrupting immediately");
                shutdownThread.interrupt();
            }
            //otherwise check the state of the thread
            else {
                //If the thread is blocked or waiting and has been for longer than the max wait time
                //interrupt the thread. If not in blocked or waiting state update the wait-start time
                final State state = shutdownThread.getState();
                switch (state) {
                case BLOCKED:
                case TIMED_WAITING:
                case WAITING: {
                    final long waitTime = TimeUnit.NANOSECONDS.toMillis(now - waitStart);
                    if (waitTime > shutdownThreadMaxWaitTime) {
                        logger.info("Shutdown thread " + shutdownThread.getName() + " has been waiting for "
                                + waitTime + "ms, interrupting");
                        shutdownThread.interrupt();
                    } else {
                        break;
                    }
                }

                default: {
                    waitStart = now;
                    break;
                }
                }
            }

            //Sleep between state checks, don't want to overload anything
            try {
                Thread.sleep(shutdownThreadPollRate);
            } catch (InterruptedException e) {
                //ignore
            }
        }
    } finally {
        this.shutdownLock.unlock();
    }
}

From source file:org.apache.catalina.cluster.tcp.SimpleTcpCluster.java

/**
 * Prepare for the beginning of active use of the public methods of this
 * component.  This method should be called after <code>configure()</code>,
 * and before any of the public methods of the component are utilized.<BR>
 * Starts the cluster communication channel, this will connect with the
 * other nodes in the cluster, and request the current session state to
 * be transferred to this node./*from ww w.  j  ava 2 s.c  om*/
 *
 * @exception IllegalStateException if this component has already been
 *  started
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
public void start() throws LifecycleException {
    if (started)
        throw new LifecycleException(sm.getString("cluster.alreadyStarted"));
    log.info("Cluster is about to start");
    try {
        if (isJdk13) {
            Jdk13ReplicationListener mReplicationListener = new Jdk13ReplicationListener(this,
                    this.tcpThreadCount, this.tcpAddress, this.tcpPort, this.tcpSelectorTimeout,
                    "synchronous".equals(this.replicationMode));
            Thread t = new Thread(mReplicationListener);
            t.setName("Cluster-TcpListener");
            t.setDaemon(true);
            t.start();
        } else {
            ReplicationListener mReplicationListener = new ReplicationListener(this, this.tcpThreadCount,
                    this.tcpAddress, this.tcpPort, this.tcpSelectorTimeout,
                    IDataSenderFactory.SYNC_MODE.equals(replicationMode)
                            || IDataSenderFactory.POOLED_SYNC_MODE.equals(replicationMode));
            mReplicationListener.setName("Cluster-ReplicationListener");
            mReplicationListener.setDaemon(true);
            mReplicationListener.start();
        }

        mReplicationTransmitter = new ReplicationTransmitter(new IDataSender[0]);
        mReplicationTransmitter.start();

        //wait 5 seconds to establish the view membership
        log.info("Sleeping for " + (msgFrequency * 4) + " secs to establish cluster membership");
        service = MembershipFactory.getMembershipService(serviceclass, svcproperties);
        service.addMembershipListener(this);
        service.start();
        Thread.currentThread().sleep((msgFrequency * 4));
        this.started = true;
    } catch (Exception x) {
        log.error("Unable to start cluster.", x);
    }

}

From source file:org.apache.hadoop.metrics2.impl.TestSinkQueue.java

private SinkQueue<Integer> newSleepingConsumerQueue(int capacity, int... values) {
    final SinkQueue<Integer> q = new SinkQueue<Integer>(capacity);
    for (int i : values) {
        q.enqueue(i);// w w w  .j  a  v a  2s . c  o  m
    }
    Thread t = new Thread() {
        @Override
        public void run() {
            try {
                q.consume(new Consumer<Integer>() {
                    public void consume(Integer e) throws InterruptedException {
                        LOG.info("sleeping");
                        Thread.sleep(1000 * 86400); // a long time
                    }
                });
            } catch (InterruptedException ex) {
                LOG.warn("Interrupted", ex);
            }
        }
    };
    t.setName("Sleeping consumer");
    t.setDaemon(true); // so jvm can exit
    t.start();
    Thread.yield(); // Let the consumer consume
    LOG.debug("Returning new sleeping consumer queue");
    return q;
}

From source file:net.sf.ehcache.constructs.web.filter.CachingFilter.java

/**
 * Check that this caching filter is not being reentered by the same recursively.
 * Recursive calls will block indefinitely because the first request has not yet
 * unblocked the cache./*from w  ww  .  ja  v a  2  s .  co  m*/
 * <p/>
 * This condition usually indicates an error in filter chaining or RequestDispatcher
 * dispatching.
 *
 * @param httpRequest
 * @throws FilterNonReentrantException if reentry is detected
 */
protected void checkNoReentry(final HttpServletRequest httpRequest) throws FilterNonReentrantException {
    Thread thread = Thread.currentThread();
    String threadName = thread.getName();
    String filterName = getClass().getName();
    if (thread.getName().indexOf(" been through " + filterName) != -1) {
        throw new FilterNonReentrantException("The request thread is attempting to reenter" + " filter "
                + filterName + ". URL: " + httpRequest.getRequestURL());
    }
    //Instrument thread name
    thread.setName(thread.getName() + " been through " + filterName);
    String newThreadName = thread.getName();
    if (LOG.isDebugEnabled()) {
        LOG.debug("Thread name changed from " + threadName + " to " + newThreadName);
    }
}