This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 213640
Collapse All | Expand All

(-)a/glassfish.common/manifest.mf (-1 / +1 lines)
Lines 3-8 Link Here
3
OpenIDE-Module-Install: org/netbeans/modules/glassfish/common/Installer.class
3
OpenIDE-Module-Install: org/netbeans/modules/glassfish/common/Installer.class
4
OpenIDE-Module-Layer: org/netbeans/modules/glassfish/common/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/glassfish/common/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/glassfish/common/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/glassfish/common/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.23
6
OpenIDE-Module-Specification-Version: 1.24
7
OpenIDE-Module-Provides: org.netbeans.modules.glassfish.common
7
OpenIDE-Module-Provides: org.netbeans.modules.glassfish.common
8
8
(-)a/glassfish.common/src/org/netbeans/modules/glassfish/common/Bundle.properties (-1 / +1 lines)
Lines 84-90 Link Here
84
MSG_ServerCmdRunning={0} running on {1}
84
MSG_ServerCmdRunning={0} running on {1}
85
MSG_ServerCmdCompleted={0} completed on {1}
85
MSG_ServerCmdCompleted={0} completed on {1}
86
MSG_ServerCmdFailed={0} failed on {1} \n {2}
86
MSG_ServerCmdFailed={0} failed on {1} \n {2}
87
MSG_ServerCmdFailedIncorrectInstance={0} failed. Instance is not {1}.
87
MSG_ServerCmdFailedIncorrectInstance={0} failed. Instance is not {1} or it is not running.
88
MSG_AuthorizationFailed=Authorization failed for {0} on {1}.  Bad password?
88
MSG_AuthorizationFailed=Authorization failed for {0} on {1}.  Bad password?
89
MSG_AuthorizationFailedRemote=Authorization failed for {0} on {1}.  Have you run the enable-secure-admin command?
89
MSG_AuthorizationFailedRemote=Authorization failed for {0} on {1}.  Have you run the enable-secure-admin command?
90
MSG_Exception={0}
90
MSG_Exception={0}
(-)a/glassfish.common/src/org/netbeans/modules/glassfish/common/CommonServerSupport.java (-3 / +3 lines)
Lines 48-54 Link Here
48
import java.net.InetSocketAddress;
48
import java.net.InetSocketAddress;
49
import java.net.Socket;
49
import java.net.Socket;
50
import java.net.URL;
50
import java.net.URL;
51
import java.util.Arrays;
52
import java.util.Collection;
51
import java.util.Collection;
53
import java.util.Collections;
52
import java.util.Collections;
54
import java.util.HashMap;
53
import java.util.HashMap;
Lines 78-84 Link Here
78
import org.netbeans.modules.glassfish.spi.ServerCommand;
77
import org.netbeans.modules.glassfish.spi.ServerCommand;
79
import org.netbeans.modules.glassfish.spi.ServerCommand.GetPropertyCommand;
78
import org.netbeans.modules.glassfish.spi.ServerCommand.GetPropertyCommand;
80
import org.netbeans.modules.glassfish.spi.CommandFactory;
79
import org.netbeans.modules.glassfish.spi.CommandFactory;
81
import org.netbeans.modules.glassfish.spi.GlassfishModule2;
80
import org.netbeans.modules.glassfish.spi.GlassfishModule3;
82
import org.netbeans.modules.glassfish.spi.Utils;
81
import org.netbeans.modules.glassfish.spi.Utils;
83
import org.netbeans.modules.glassfish.spi.VMIntrospector;
82
import org.netbeans.modules.glassfish.spi.VMIntrospector;
84
import org.openide.DialogDisplayer;
83
import org.openide.DialogDisplayer;
Lines 93-99 Link Here
93
 *
92
 *
94
 * @author Peter Williams
93
 * @author Peter Williams
95
 */
94
 */
96
public class CommonServerSupport implements GlassfishModule2, RefreshModulesCookie {
95
public class CommonServerSupport implements GlassfishModule3, RefreshModulesCookie {
97
96
98
    private final transient Lookup lookup;
97
    private final transient Lookup lookup;
99
    private final Map<String, String> properties =
98
    private final Map<String, String> properties =
Lines 424-429 Link Here
424
        return task;
423
        return task;
425
    }
424
    }
426
425
426
    
427
    @Override
427
    @Override
428
    public Future<OperationState> restartServer(OperationStateListener stateListener) {
428
    public Future<OperationState> restartServer(OperationStateListener stateListener) {
429
        Logger.getLogger("glassfish").log(Level.FINEST, "CSS.restartServer called on thread \"{0}\"", Thread.currentThread().getName()); // NOI18N
429
        Logger.getLogger("glassfish").log(Level.FINEST, "CSS.restartServer called on thread \"{0}\"", Thread.currentThread().getName()); // NOI18N
(-)6497ddae98ca (+56 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.glassfish.spi;
43
44
/**
45
 * Extended version of GlassfishModule supporting the server state refresh.
46
 * 
47
 * @author Petr Hejl
48
 * @since 1.24
49
 */
50
public interface GlassfishModule3 extends GlassfishModule2 {
51
    
52
    /**
53
     * Requests the refresh of the server state.
54
     */
55
    void refresh();
56
}
(-)a/glassfish.javaee/manifest.mf (-1 / +1 lines)
Lines 4-8 Link Here
4
OpenIDE-Module-Layer: org/netbeans/modules/glassfish/javaee/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/glassfish/javaee/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/glassfish/javaee/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/glassfish/javaee/Bundle.properties
6
OpenIDE-Module-Provides: org.netbeans.modules.serverplugins.javaee
6
OpenIDE-Module-Provides: org.netbeans.modules.serverplugins.javaee
7
OpenIDE-Module-Specification-Version: 1.15
7
OpenIDE-Module-Specification-Version: 1.16
8
8
(-)a/glassfish.javaee/nbproject/project.xml (-1 / +1 lines)
Lines 118-124 Link Here
118
                    <compile-dependency/>
118
                    <compile-dependency/>
119
                    <run-dependency>
119
                    <run-dependency>
120
                        <release-version>0-1</release-version>
120
                        <release-version>0-1</release-version>
121
                        <specification-version>1.14</specification-version>
121
                        <specification-version>1.24</specification-version>
122
                    </run-dependency>
122
                    </run-dependency>
123
                </dependency>
123
                </dependency>
124
                <dependency>
124
                <dependency>
(-)a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2StartServer.java (-1 / +22 lines)
Lines 47-52 Link Here
47
import java.util.Iterator;
47
import java.util.Iterator;
48
import java.util.List;
48
import java.util.List;
49
import java.util.concurrent.CopyOnWriteArrayList;
49
import java.util.concurrent.CopyOnWriteArrayList;
50
import java.util.concurrent.Executors;
51
import java.util.concurrent.ScheduledExecutorService;
52
import java.util.concurrent.TimeUnit;
50
import java.util.logging.Level;
53
import java.util.logging.Level;
51
import java.util.logging.Logger;
54
import java.util.logging.Logger;
52
import javax.enterprise.deploy.shared.ActionType;
55
import javax.enterprise.deploy.shared.ActionType;
Lines 71-76 Link Here
71
import org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer;
74
import org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer;
72
import org.netbeans.modules.glassfish.spi.GlassfishModule;
75
import org.netbeans.modules.glassfish.spi.GlassfishModule;
73
import org.netbeans.modules.glassfish.spi.GlassfishModule.OperationState;
76
import org.netbeans.modules.glassfish.spi.GlassfishModule.OperationState;
77
import org.netbeans.modules.glassfish.spi.GlassfishModule3;
74
import org.netbeans.modules.glassfish.spi.OperationStateListener;
78
import org.netbeans.modules.glassfish.spi.OperationStateListener;
75
import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerSupport;
79
import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerSupport;
76
import org.openide.DialogDescriptor;
80
import org.openide.DialogDescriptor;
Lines 437-443 Link Here
437
            return this; //we failed to start the server.
441
            return this; //we failed to start the server.
438
        }
442
        }
439
443
440
        GlassfishModule commonSupport = getCommonServerSupport();
444
        final GlassfishModule commonSupport = getCommonServerSupport();
441
        if (commonSupport != null) {
445
        if (commonSupport != null) {
442
            if (isClusterOrInstance(commonSupport)) {
446
            if (isClusterOrInstance(commonSupport)) {
443
                fireHandleProgressEvent(null, new Hk2DeploymentStatus(
447
                fireHandleProgressEvent(null, new Hk2DeploymentStatus(
Lines 478-483 Link Here
478
                    fireHandleProgressEvent(null, new Hk2DeploymentStatus(
482
                    fireHandleProgressEvent(null, new Hk2DeploymentStatus(
479
                        CommandType.START, translateState(newState), ActionType.EXECUTE,
483
                        CommandType.START, translateState(newState), ActionType.EXECUTE,
480
                        message));
484
                        message));
485
486
                    // FIXME this is pretty ugly workaround and if this is still
487
                    // needed once GF plugin is rewritten we should introduce
488
                    // some API to notify about external changes of server state
489
                    final ScheduledExecutorService statusUpdater = Executors.newSingleThreadScheduledExecutor();
490
                    statusUpdater.scheduleAtFixedRate(new Runnable() {
491
492
                        @Override
493
                        public void run() {
494
                            if (ProfilerSupport.getState() == ProfilerSupport.STATE_INACTIVE) {
495
                                statusUpdater.shutdownNow();
496
                                if (commonSupport instanceof GlassfishModule3) {
497
                                    ((GlassfishModule3) commonSupport).refresh();
498
                                }
499
                            }
500
                        }
501
                    }, 50, 100, TimeUnit.MILLISECONDS);
481
                }
502
                }
482
            }, GlassfishModule.ServerState.STOPPED_JVM_PROFILER);
503
            }, GlassfishModule.ServerState.STOPPED_JVM_PROFILER);
483
        }
504
        }
(-)a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ServerInstance.java (-27 / +36 lines)
Lines 72-77 Link Here
72
import java.util.concurrent.ScheduledExecutorService;
72
import java.util.concurrent.ScheduledExecutorService;
73
import java.util.concurrent.TimeUnit;
73
import java.util.concurrent.TimeUnit;
74
import java.util.concurrent.TimeoutException;
74
import java.util.concurrent.TimeoutException;
75
import java.util.concurrent.atomic.AtomicReference;
75
import java.util.logging.Level;
76
import java.util.logging.Level;
76
import java.util.logging.Logger;
77
import java.util.logging.Logger;
77
import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
78
import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
Lines 181-187 Link Here
181
    
182
    
182
    private final ChangeSupport managerChangeSupport = new ChangeSupport(this);
183
    private final ChangeSupport managerChangeSupport = new ChangeSupport(this);
183
    
184
    
184
    private volatile static ServerInstance profiledServerInstance;
185
    private static AtomicReference<ServerInstance> profiledServerInstance = new AtomicReference<ServerInstance>();
185
    
186
    
186
    private final DebuggerStateListener debuggerStateListener;
187
    private final DebuggerStateListener debuggerStateListener;
187
    
188
    
Lines 376-382 Link Here
376
                try {
377
                try {
377
                    int oldState = getServerState();
378
                    int oldState = getServerState();
378
                    setServerState(STATE_WAITING);
379
                    setServerState(STATE_WAITING);
379
                    if (ServerInstance.this == profiledServerInstance) {
380
                    if (ServerInstance.this == profiledServerInstance.get()) {
380
                        updateStateFromProfiler();
381
                        updateStateFromProfiler();
381
                        return;
382
                        return;
382
                    }
383
                    }
Lines 1107-1113 Link Here
1107
    throws ServerException {
1108
    throws ServerException {
1108
        // check whether another server not already running in profile mode
1109
        // check whether another server not already running in profile mode
1109
        // and ask whether it is ok to stop it
1110
        // and ask whether it is ok to stop it
1110
        ServerInstance tmpProfiledServerInstance = profiledServerInstance;
1111
        ServerInstance tmpProfiledServerInstance = profiledServerInstance.get();
1111
        if (tmpProfiledServerInstance != null && tmpProfiledServerInstance != this) {
1112
        if (tmpProfiledServerInstance != null && tmpProfiledServerInstance != this) {
1112
            String msg = NbBundle.getMessage(
1113
            String msg = NbBundle.getMessage(
1113
                                    ServerInstance.class,
1114
                                    ServerInstance.class,
Lines 1138-1144 Link Here
1138
        try {
1139
        try {
1139
            setServerState(STATE_WAITING);
1140
            setServerState(STATE_WAITING);
1140
            boolean inDebug = isDebuggable(null);
1141
            boolean inDebug = isDebuggable(null);
1141
            boolean inProfile = profiledServerInstance == this;
1142
            boolean inProfile = profiledServerInstance.get() == this;
1142
            boolean stopped = true;
1143
            boolean stopped = true;
1143
            
1144
            
1144
            if (inProfile || isReallyRunning() || isSuspended()) {
1145
            if (inProfile || isReallyRunning() || isSuspended()) {
Lines 1166-1172 Link Here
1166
    public void stop(ProgressUI ui) throws ServerException {
1167
    public void stop(ProgressUI ui) throws ServerException {
1167
        try {
1168
        try {
1168
            setServerState(STATE_WAITING);
1169
            setServerState(STATE_WAITING);
1169
            if (profiledServerInstance == this || isReallyRunning() || isSuspended()) {
1170
            if (profiledServerInstance.get() == this || isReallyRunning() || isSuspended()) {
1170
                _stop(ui);
1171
                _stop(ui);
1171
            }
1172
            }
1172
            debugInfo.clear();
1173
            debugInfo.clear();
Lines 1488-1506 Link Here
1488
                                    Target target, 
1489
                                    Target target, 
1489
                                    boolean forceRestart,
1490
                                    boolean forceRestart,
1490
                                    ProgressUI ui) throws ServerException {
1491
                                    ProgressUI ui) throws ServerException {
1491
        ServerInstance tmpProfiledServerInstance = profiledServerInstance;
1492
        ServerInstance tmpProfiledServerInstance = profiledServerInstance.get();
1492
        if (tmpProfiledServerInstance == this && !forceRestart) {
1493
        if (tmpProfiledServerInstance == this && !forceRestart) {
1493
            return; // server is already runnning in profile mode, no need to restart the server
1494
            return; // server is already runnning in profile mode, no need to restart the server
1494
        }
1495
        }
1495
        if (tmpProfiledServerInstance != null && tmpProfiledServerInstance != this) {
1496
        if (tmpProfiledServerInstance != null && tmpProfiledServerInstance != this) {
1496
            // another server currently running in profiler mode
1497
            // another server currently running in profiler mode
1497
            tmpProfiledServerInstance.stop(ui);
1498
            tmpProfiledServerInstance.stop(ui);
1498
            profiledServerInstance = null;
1499
            boolean done = profiledServerInstance.compareAndSet(tmpProfiledServerInstance, null);
1500
            assert done : "Unxpected profiled instance " + profiledServerInstance.get();
1499
        }
1501
        }
1500
        if (profiledServerInstance == this || isReallyRunning() || isDebuggable(target)) {
1502
        if (profiledServerInstance.get() == this || isReallyRunning() || isDebuggable(target)) {
1501
            _stop(ui);
1503
            _stop(ui);
1502
            debugInfo.clear();
1504
            debugInfo.clear();
1503
            profiledServerInstance = null;
1505
            //profiledServerInstance = null;
1504
        }
1506
        }
1505
        
1507
        
1506
        final Profiler profiler = ServerRegistry.getProfiler();
1508
        final Profiler profiler = ServerRegistry.getProfiler();
Lines 1510-1515 Link Here
1510
        }
1512
        }
1511
        
1513
        
1512
        final ScheduledExecutorService statusUpdater = Executors.newSingleThreadScheduledExecutor();
1514
        final ScheduledExecutorService statusUpdater = Executors.newSingleThreadScheduledExecutor();
1515
        
1516
        final StateListener l = new StateListener() {
1517
1518
            @Override
1519
            public void stateChanged(int oldState, int newState) {
1520
                if (oldState != newState && newState == STATE_STOPPED) {
1521
                    ServerInstance.this.removeStateListener(this);
1522
                    statusUpdater.shutdownNow();
1523
                    ServerInstance.this.refresh();
1524
                    boolean done = profiledServerInstance.compareAndSet(ServerInstance.this, null);
1525
                    assert done : "Unxpected profiled instance " + profiledServerInstance.get();
1526
                }
1527
            }
1528
        };
1529
        
1530
        this.addStateListener(l);
1531
        profiler.notifyStarting();
1532
        
1513
        statusUpdater.scheduleAtFixedRate(new Runnable() {
1533
        statusUpdater.scheduleAtFixedRate(new Runnable() {
1514
1534
1515
            @Override
1535
            @Override
Lines 1518-1538 Link Here
1518
            }
1538
            }
1519
        }, 50, 100, TimeUnit.MILLISECONDS);
1539
        }, 50, 100, TimeUnit.MILLISECONDS);
1520
        
1540
        
1521
        final StateListener l = new StateListener() {
1522
1523
            @Override
1524
            public void stateChanged(int oldState, int newState) {
1525
                if (oldState != newState && newState == STATE_STOPPED) {
1526
                    ServerInstance.this.removeStateListener(this);
1527
                    statusUpdater.shutdownNow();
1528
                    profiledServerInstance = null;
1529
                }
1530
            }
1531
        };
1532
        
1533
        this.addStateListener(l);
1534
        
1535
        profiler.notifyStarting();
1536
        ProgressObject po = getStartServer().startProfiling(target);
1541
        ProgressObject po = getStartServer().startProfiling(target);
1537
        try {
1542
        try {
1538
            boolean completedSuccessfully = ProgressObjectUtil.trackProgressObject(ui, po, DEFAULT_TIMEOUT);
1543
            boolean completedSuccessfully = ProgressObjectUtil.trackProgressObject(ui, po, DEFAULT_TIMEOUT);
Lines 1543-1549 Link Here
1543
            String msg = NbBundle.getMessage(ServerInstance.class, "MSG_StartProfileTimeout", getDisplayName());
1548
            String msg = NbBundle.getMessage(ServerInstance.class, "MSG_StartProfileTimeout", getDisplayName());
1544
            throw new ServerException(msg);
1549
            throw new ServerException(msg);
1545
        }
1550
        }
1546
        profiledServerInstance = this;
1551
        profiledServerInstance.set(this);
1547
        synchronized (this) {
1552
        synchronized (this) {
1548
            managerStartedByIde = true;
1553
            managerStartedByIde = true;
1549
//            coTarget = null;
1554
//            coTarget = null;
Lines 1573-1581 Link Here
1573
    // stopDeploymentManager
1578
    // stopDeploymentManager
1574
    private void _stop(ProgressUI ui) throws ServerException {
1579
    private void _stop(ProgressUI ui) throws ServerException {
1575
        // if the server is started in profile mode, deattach profiler first
1580
        // if the server is started in profile mode, deattach profiler first
1576
        if (profiledServerInstance == this) {
1581
        if (profiledServerInstance.get() == this) {
1577
            shutdownProfiler(ui);
1582
            shutdownProfiler(ui);
1578
            profiledServerInstance = null;
1583
            boolean done = profiledServerInstance.compareAndSet(this, null);
1584
            assert done : "Unxpected profiled instance " + profiledServerInstance.get();
1579
        }
1585
        }
1580
        synchronized (this) {
1586
        synchronized (this) {
1581
            // if the server is suspended, the debug session has to be terminated first
1587
            // if the server is suspended, the debug session has to be terminated first
Lines 1728-1733 Link Here
1728
    }
1734
    }
1729
    
1735
    
1730
    private void fireStateChanged(int oldState, int newState) {
1736
    private void fireStateChanged(int oldState, int newState) {
1737
        if (oldState == newState) {
1738
            return;
1739
        }
1731
        StateListener[] listeners;
1740
        StateListener[] listeners;
1732
        synchronized (stateListeners) {
1741
        synchronized (stateListeners) {
1733
            listeners = (StateListener[])stateListeners.toArray(new StateListener[stateListeners.size()]);
1742
            listeners = (StateListener[])stateListeners.toArray(new StateListener[stateListeners.size()]);

Return to bug 213640