EMMA Coverage Report (generated Mon Mar 20 21:27:43 EST 2006)
[all classes][com.webhydra.slug.process]

COVERAGE SUMMARY FOR SOURCE FILE [UnlimitedProcessRunner.java]

nameclass, %method, %block, %line, %
UnlimitedProcessRunner.java100% (1/1)100% (5/5)100% (38/38)100% (12/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class UnlimitedProcessRunner100% (1/1)100% (5/5)100% (38/38)100% (12/12)
UnlimitedProcessRunner (): void 100% (1/1)100% (3/3)100% (2/2)
activeCount (): long 100% (1/1)100% (5/5)100% (1/1)
add (SluggishProcess, String): String 100% (1/1)100% (17/17)100% (4/4)
prepare (): void 100% (1/1)100% (7/7)100% (2/2)
release (): void 100% (1/1)100% (6/6)100% (3/3)

1/*
2 * @(#) $Id: UnlimitedProcessRunner.java,v 1.1.1.1 2006/03/19 06:09:42 rossen Exp $
3 *
4 * Copyright (c) 2006, WebHydra.com
5 * All rights reserved.
6 * 
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * 
10 *     * Redistributions of source code must retain the above copyright notice,
11 *       this list of conditions and the following disclaimer.
12 *     * Redistributions in binary form must reproduce the above copyright
13 *       notice, this list of conditions and the following disclaimer in the
14 *       documentation and/or other materials provided with the distribution.
15 *     * Neither the name of the WebHydra.com nor the names of its contributors
16 *       may be used to endorse or promote products derived from this software
17 *       without specific prior written permission.
18 * 
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31 
32package com.webhydra.slug.process;
33 
34import java.security.InvalidParameterException;
35import java.util.Date;
36import java.util.HashMap;
37import java.util.Map;
38import javax.servlet.http.HttpSession;
39 
40/**
41 * Basic ISlugRunner implmentation without any thread restrictions.<p>
42 * A new thread is created and started with provided SluggishProcess.<br>
43 * None process or thread limitation are implemented and threads are not pulled.
44 * @author rossen
45 */
46public class UnlimitedProcessRunner extends AbstractProcessRunner implements ISlugRunner
47{
48 
49    /** Sluggis processes thread group */
50    ThreadGroup slugsGrp;
51 
52    /** Creates a new instance of UnlimitedProcessRunner */
53    public UnlimitedProcessRunner()
54    {
55    }
56 
57    /**
58     * Default empty implelemtation
59     */
60    public void prepare() {
61        slugsGrp = new ThreadGroup("UnlimitedSlugs");
62    }
63 
64 
65    /**
66     * Default implementation.
67     * Si,pyt invoces <code>clean()</code>.
68     * @see #clear()
69     */
70    public void release() {
71        super.release();
72        slugsGrp = null;
73    }
74 
75    /**
76     * Add and execute a new SluggishProcess for execution.
77     * @param proc process to be executed.
78     * @param session current user session ID.
79     * @return Proccess ID (<code>PID</code>) assigned to provided process/session pair.
80     * @exception InvalidParameterException if any of the provided parameters is null.
81     */
82    public String add(SluggishProcess proc, String session) throws InvalidParameterException
83    {
84        String pid = save(proc, session);
85        Thread t = new Thread(slugsGrp, proc, pid);
86        t.start();
87        return pid;
88    }
89 
90    /**
91     * Returns the count of all active processes
92     * @return the number of actively running sluggish processes.
93     */
94    public long activeCount()
95    {
96        return slugsGrp.activeCount();
97    }
98 
99}

[all classes][com.webhydra.slug.process]
EMMA 2.0.5312 (C) Vladimir Roubtsov