• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aspectran / aspectran / #3996

19 Jan 2025 10:05AM CUT coverage: 35.369% (-0.03%) from 35.394%
#3996

push

github

topframe
[maven-release-plugin] prepare release v8.3.0

14217 of 40196 relevant lines covered (35.37%)

0.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.67
/daemon/src/main/java/com/aspectran/daemon/command/builtins/QuitCommand.java
1
/*
2
 * Copyright (c) 2008-2025 The Aspectran Project
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.aspectran.daemon.command.builtins;
17

18
import com.aspectran.daemon.command.AbstractCommand;
19
import com.aspectran.daemon.command.CommandParameters;
20
import com.aspectran.daemon.command.CommandRegistry;
21
import com.aspectran.daemon.command.CommandResult;
22
import com.aspectran.utils.annotation.jsr305.NonNull;
23

24
public class QuitCommand extends AbstractCommand {
25

26
    private static final String NAMESPACE = "builtins";
27

28
    private static final String COMMAND_NAME = "quit";
29

30
    private final CommandDescriptor descriptor = new CommandDescriptor();
1✔
31

32
    public QuitCommand(CommandRegistry registry) {
33
        super(registry, true);
1✔
34
    }
1✔
35

36
    @Override
37
    public CommandResult execute(CommandParameters parameters) {
38
        if (!getCommandRegistry().getDaemon().isWaiting()) {
×
39
            return failed(getCommandRegistry().getDaemon().getName() + " does not support the quit command");
×
40
        }
41

42
        info("Shutting down the " + getCommandRegistry().getDaemon().getName());
×
43
        getCommandRegistry().getDaemon().stop();
×
44

45
        return success(info("Goodbye."));
×
46
    }
47

48
    @Override
49
    public Descriptor getDescriptor() {
50
        return descriptor;
1✔
51
    }
52

53
    private static class CommandDescriptor implements Descriptor {
54

55
        @Override
56
        public String getNamespace() {
57
            return NAMESPACE;
×
58
        }
59

60
        @Override
61
        public String getName() {
62
            return COMMAND_NAME;
1✔
63
        }
64

65
        @Override
66
        @NonNull
67
        public String getDescription() {
68
            return "Releases all resources and exits this daemon";
×
69
        }
70

71
    }
72

73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc