You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by thusith2wije <gi...@git.apache.org> on 2016/08/29 15:35:29 UTC

[GitHub] activemq-artemis pull request #737: Added LargeStreamletTest file

GitHub user thusith2wije opened a pull request:

    https://github.com/apache/activemq-artemis/pull/737

    Added  LargeStreamletTest file

    I added LargeStreamletTest.java file and marked some changes. please consider about that 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/thusith2wije/activemq-artemis master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/737.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #737
    
----
commit 533e3994b069dbab2e4ca47307159f4acdd6fed5
Author: Thusitha Wijerathne <th...@gmail.com>
Date:   2016-07-30T02:58:09Z

    Added  LargeStreamletTest file

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #737: Added LargeStreamletTest file

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/activemq-artemis/pull/737


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #737: Added LargeStreamletTest file

Posted by mtaylor <gi...@git.apache.org>.
Github user mtaylor commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/737#discussion_r80891649
  
    --- Diff: LargeStreamletTest ---
    @@ -0,0 +1,160 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.activemq;
    +
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    --- End diff --
    
    Looks like you included the license twice.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #737: Added LargeStreamletTest file

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/737#discussion_r76630335
  
    --- Diff: LargeStreamletTest ---
    @@ -0,0 +1,160 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.activemq;
    +
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +import java.io.InputStream;
    +import java.io.OutputStream;
    +import java.util.Random;
    +import java.util.concurrent.atomic.AtomicBoolean;
    +import java.util.concurrent.atomic.AtomicInteger;
    +
    +import javax.jms.Destination;
    +import javax.jms.Session;
    +
    +import junit.framework.Assert;
    +import junit.framework.TestCase;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +/**
    + * @author rnewson
    --- End diff --
    
    We are not using ``@author`` tags. Your git commit should be enough to give you author status.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis issue #737: Added LargeStreamletTest file

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/737
  
    What is the purpose of this test? You didn't implement the Streamlet.. or it was already implemented?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis issue #737: Added LargeStreamletTest file

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/737
  
    Your file is at the root of the folder. which is totally wrong.
    
    
    Can you either fix it or close it?
    
    
    Actually, can you just close this? I don't see a purpose on the test your'e adding.. and even so it's at a wrong location.
    
    
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis issue #737: Added LargeStreamletTest file

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/737
  
    so, can you close this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #737: Added LargeStreamletTest file

Posted by mtaylor <gi...@git.apache.org>.
Github user mtaylor commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/737#discussion_r80891877
  
    --- Diff: LargeStreamletTest ---
    @@ -0,0 +1,160 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.activemq;
    +
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +import java.io.InputStream;
    +import java.io.OutputStream;
    +import java.util.Random;
    +import java.util.concurrent.atomic.AtomicBoolean;
    +import java.util.concurrent.atomic.AtomicInteger;
    +
    +import javax.jms.Destination;
    +import javax.jms.Session;
    +
    +import junit.framework.Assert;
    +import junit.framework.TestCase;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +/**
    + * @author rnewson
    + */
    +public final class LargeStreamletTest extends TestCase {
    +
    +    private static final Logger LOG = LoggerFactory.getLogger(LargeStreamletTest.class);
    +    private static final String BROKER_URL = "vm://localhost?broker.persistent=false";
    +    private static final int BUFFER_SIZE = 1 * 1024;
    +    private static final int MESSAGE_COUNT = 10 * 1024;
    +
    +    protected Exception writerException;
    +    protected Exception readerException;
    +
    +    private AtomicInteger totalRead = new AtomicInteger();
    +    private AtomicInteger totalWritten = new AtomicInteger();
    +    private AtomicBoolean stopThreads = new AtomicBoolean(false);
    +
    +    public void testStreamlets() throws Exception {
    +        final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(BROKER_URL);
    +
    +        final ActiveMQConnection connection = (ActiveMQConnection)factory.createConnection();
    +        connection.start();
    +        try {
    +            final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    +            try {
    +                final Destination destination = session.createQueue("wibble");
    +                final Thread readerThread = new Thread(new Runnable() {
    +
    +                    public void run() {
    +                        totalRead.set(0);
    +                        try {
    +                            final InputStream inputStream = connection.createInputStream(destination);
    +                            try {
    +                                int read;
    +                                final byte[] buf = new byte[BUFFER_SIZE];
    +                                while (!stopThreads.get() && (read = inputStream.read(buf)) != -1) {
    +                                    totalRead.addAndGet(read);
    +                                }
    +                            } finally {
    +                                inputStream.close();
    +                            }
    +                        } catch (Exception e) {
    +                            readerException = e;
    +                            e.printStackTrace();
    +                        } finally {
    +                            LOG.info(totalRead + " total bytes read.");
    +                        }
    +                    }
    +                });
    +
    +                final Thread writerThread = new Thread(new Runnable() {
    +                    private final Random random = new Random();
    +
    +                    public void run() {
    +                        totalWritten.set(0);
    +                        int count = MESSAGE_COUNT;
    +                        try {
    +                            final OutputStream outputStream = connection.createOutputStream(destination);
    +                            try {
    +                                final byte[] buf = new byte[BUFFER_SIZE];
    +                                random.nextBytes(buf);
    +                                while (count > 0 && !stopThreads.get()) {
    +                                    outputStream.write(buf);
    +                                    totalWritten.addAndGet(buf.length);
    +                                    count--;
    +                                }
    +                            } finally {
    +                                outputStream.close();
    +                            }
    +                        } catch (Exception e) {
    +                            writerException = e;
    +                            e.printStackTrace();
    +                        } finally {
    +                            LOG.info(totalWritten + " total bytes written.");
    +                        }
    +                    }
    +                });
    +
    +                readerThread.start();
    +                writerThread.start();
    +
    +                // Wait till reader is has finished receiving all the messages
    +                // or he has stopped
    +                // receiving messages.
    +                Thread.sleep(1000);
    --- End diff --
    
    Instead of a thread.sleep(1000) could you use a countdown latch to determine when the reader has finished?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #737: Added LargeStreamletTest file

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/737#discussion_r76630418
  
    --- Diff: LargeStreamletTest ---
    @@ -0,0 +1,160 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.activemq;
    +
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +import java.io.InputStream;
    +import java.io.OutputStream;
    +import java.util.Random;
    +import java.util.concurrent.atomic.AtomicBoolean;
    +import java.util.concurrent.atomic.AtomicInteger;
    +
    +import javax.jms.Destination;
    +import javax.jms.Session;
    +
    +import junit.framework.Assert;
    +import junit.framework.TestCase;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +/**
    + * @author rnewson
    --- End diff --
    
    It will actually fail a verification from checkstyle.
    
    
    Try building it yourself:
    
    
    mvn install -Pdev
    
    (this should activate checkstyles)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---