Login Email with Google to Specific Domain Name

I am not able to find any documentation on how to restrict the login to my web application to only accept authentication requests from users with an email on a specific domain name or set of domain names. I would like to block as opposed to blacklist.

Does anyone have any document or template which how to achieve using jsp,angularjs,javascript, documentation on the officially accepted method of doing so, or an easy, secure work around?

For the record, I do not know any info about the user until they attempt to log in through Google’s OAuth authentication. All I receive back is the basic user info and email.

Is there anything wrong with the code?execution of getText() and format() not working

Is there anything wrong with the code?execution of getText() and format() not working.

public RendererOptions getRendererOptions() {

            return new PieRendererOptions() {

                public Object getDataLabels() {

                    float sum = 0;
                    List<String> labels = new ArrayList<>(counter.getSize());
                    List<BigDecimal> addd = new ArrayList<>(counter.getSize());
                    for (Value val : counter) {
                    Object[] arr = addd.toArray();
                    for (int i = 0; i < addd.size(); i++) {
                        sum = sum + (int) arr[i];
                    sum = 100 / sum;

                    for (Value val : counter) {
                        final String title = val.getText();
                        System.out.println("///////**??????????" + title);
                        final String percentage = format(counter.getCount(val).multiply(new BigDecimal(sum)));
                        System.out.println("///////**??///////////" + percentage);
                        labels.add("<DIV>" + title + "</DIV>");
                    return labels;

RabbitMQ direct reply to. I’m getting the AlreadyClosedException

I’m trying to figure out how to use the RabbitMQ direct reply-to feature. Since the documentation is rather vague on how to implement it, I tried to use the RPC example, adopting it to use direct reply-to instead.

private final static String QUEUE = "Test_chan";
private void directReplyToClient(ConnectionFactory factory) {
    Connection connection = null;
    Channel channel = null;
    String replyQueue;

    try {
        connection = factory.newConnection();
        channel = connection.createChannel();

        //replyQueue = channel.queueDeclare().getQueue();
        replyQueue = "amq.rabbitmq.reply-to";
        AMQP.BasicProperties props = new AMQP.BasicProperties
        String message = "Hello World";
        channel.basicPublish("", QUEUE, props, message.getBytes());

        final BlockingQueue<String> response = new ArrayBlockingQueue<>(1);

        channel.basicConsume(replyQueue, true, new DefaultConsumer(channel) {
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws UnsupportedEncodingException {

                response.offer(new String(body, "UTF-8"));



    } catch (IOException | TimeoutException | InterruptedException e) {
    } finally {
        try {
            if (channel != null)
            if (connection != null)
        } catch (IOException | TimeoutException _ignore) {}

Setting reply address to


works, but setting it to


gives the following exception:

Exception in thread “main” com.rabbitmq.client.AlreadyClosedException:
channel is already closed due to channel error; protocol method:
method(reply-code=406, reply-text=PRECONDITION_FAILED – fast reply consumer does not exist, class-id=60, method-id=40)

Does anyone see where I’m doing something wrong? Any pointers will be appreciated.

Bukkit (Java) Message sending as many times as people are online

I’m making a Mine Craft java server plugin, and I want to send a message to all the players that have a permission or that are included in an array-list. I have a loop setup, but it appears to be sending the message as many times as there are players online. How do I prevent/fix this? Thanks in advance! 🙂

    public void checkStart() {
    HashSet<Player> listToSet = new HashSet<Player>(this.plugin.pInGame);
    ArrayList<Player> pInGameNoDup = new ArrayList<Player>(listToSet);

    //^changing the ArrayList to a Hashset then back to Arraylist to avoid duplicates (maybe this is the issue?)

    int sizeCheck = pInGameNoDup.size();
    if (sizeCheck >= 2) {
        for (Player p : Bukkit.getOnlinePlayers()) {
            if (pInGameNoDup.contains(p) || p.isOp()) {
                p.sendMessage(label + "The Game of DeathTag has begun! Now chosing who will be it...");
                p.sendMessage(label + this.plugin.it.getName() + " has been randomly chosen to be it!");
    } else {
        for (Player p : Bukkit.getOnlinePlayers()) {
            if (p.hasPermission("tag.join") || p.isOp()) {
                p.sendMessage(label + "Not Enough People have joined, the game will not start");

How to show that throttling has occurred in camel.

I wanted to know if there was a way to do something like `System.out.printkn(); or log out that throttling has occurred. The only way I can see at the moment if throttling has occurred is by setting rejectExecution to True. The problem with that is that if it set to true then the request isn’t is processed when throttling occurs. Is there a way to notify that throttling has occurred using camel?

UnsupportedOperationException while sorting FilteredList

private final FilteredList<ReadOnlyPerson> filteredPersons;

public void sortFilteredPersonList() {

    Comparator<ReadOnlyPerson> sortByName = new Comparator<ReadOnlyPerson>() 
        public int compare(ReadOnlyPerson o1, ReadOnlyPerson o2) {
            return o1.getName().fullName.compareTo(o2.getName().fullName);


I am getting unsupportedoperationexception java.util.AbstractList.set(AbstractList.java:132)
May i know what is wrong with the code?

What does if __name__ == “__main__”: do?

What does the if __name__ == "__main__": do?

# Threading example
import time, thread

def myfunction(string, sleeptime, lock, *args):
    while 1:
if __name__ == "__main__":
    lock = thread.allocate_lock()
    thread.start_new_thread(myfunction, ("Thread #: 1", 2, lock))
    thread.start_new_thread(myfunction, ("Thread #: 2", 2, lock))

Java8: Map list of objects by key

Map<A, List<B>> xFunction() {    
    Map<A, List<B>> mapList = new HashMap<>();
    List<A> aList = x.getAList();
    for (A a : aList) {
        List<B> bList = getBList(a.getId());
        mapList.put(a, bList);
    return mapList;

How to convert this in java 8 with collect and grouping by or mapping?

I try with something like:

.map(a -> getBList(a.getId)) //return a list of B
.collect(Collectors.groupingBy (...) )